⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clockpuzzle.cpp

📁 All are the assignments of mine that I have developped in Data Structure Laboratory Hours
💻 CPP
字号:
//File: $Id: ClockPuzzle.cpp,v 1.5 2005/05/08 19:58:43 p334-01h Exp p334-01h $//Author: Matthew Dean and Chirag Pujara//Revisions: $Log: ClockPuzzle.cpp,v $//Revisions: Revision 1.5  2005/05/08 19:58:43  p334-01h//Revisions: Wrote the printPuzzle method//Revisions://Revisions: Revision 1.4  2005/04/24 18:04:34  p334-01h//Revisions: Fixed a namespace bug//Revisions://Revisions: Revision 1.3  2005/04/23 18:20:26  p334-01h//Revisions: Fixed a small bug, code still untested//Revisions://Revisions: Revision 1.2  2005/04/21 05:34:35  p334-01h//Revisions: Wrote the code, still untested as of yet//Revisions://Revisions: Revision 1.1  2005/04/21 05:33:45  p334-01h//Revisions: Initial revision//Revisions://////#include "ClockPuzzle.h"#include <iostream>#include <vector>using namespace std;ClockPuzzle::ClockPuzzle( int nHours, int curr, int fin ) {  numHours = nHours;  initial = curr;  final = fin;}ClockPuzzle::~ClockPuzzle() {}//is it the answer?bool ClockPuzzle::isAnswer( vector<int> intVec ) {  //cout << "in the isAnswer" << endl;  return( intVec.at(0) == final );}//the next configs of vector< vector<int> > ClockPuzzle::nextConfigs( vector<int> current ){  int under, over;    if( current.at(0) == 1 ) {    under = numHours;  }  else {    under = current.at(0)-1;  }  if( current.at(0) == numHours ) {    over = 1;  }  else {    over = current.at(0)+1;  }    vector<int> overVec;  vector<int> underVec;    overVec.push_back( over );  underVec.push_back( under );    vector< vector<int> > retVal;    //push the vectors onto retVal  retVal.push_back(overVec);  retVal.push_back(underVec);    return retVal;}void ClockPuzzle::printPuzzle( vector<int> in ) {  cout << "current state: ";  for( vector<int>::iterator iter = in.begin();        iter != in.end() ; iter++ ) {    cout << (*iter) << " ";  }  cout << endl;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -