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

📄 clock.cpp

📁 All are the assignments of mine that I have developped in Data Structure Laboratory Hours
💻 CPP
字号:
//File: $Id: clock.cpp,v 1.2 2005/05/08 20:00:07 p334-01h Exp p334-01h $//Author: Matthew Dean and Chirag Pujara//Revisions: $Log: clock.cpp,v $//Revisions: Revision 1.2  2005/05/08 20:00:07  p334-01h//Revisions: Code works fine, no changes planned//Revisions://Revisions: Revision 1.1  2005/05/08 19:59:07  p334-01h//Revisions: Initial revision//Revisions:////#include <iostream>#include <vector>#include "Solver.h"#include "ClockPuzzle.h"using namespace std;//is the given char argument a number?bool isNum( char* num ) {  bool isNum = true;  while( *num != '\0' ) {    if( *num < 48 || *num++ > 57 ) {      isNum = false;    }  }  return isNum;}void usage() {  cerr << "usage: clock numHrs currHour trueTime" << endl;}int main( int argc, char* argv[] ) {      //if the number of arguments is correct  if( argc == 4 ) {    if( isNum( argv[1] ) && isNum( argv[2] ) && isNum( argv[3] ) ) {      int numHours = atoi( argv[1] );      int initial = atoi( argv[2] ) ;      int final = atoi( argv[3] );      ClockPuzzle cp( numHours, initial, final );      vector<int> v;      v.push_back( initial );      Solver solve( v, cp );      solve.solve();      solve.outputAnswer();    }    else {      usage();    }  }    else {     usage();  }    return 0;}

⌨️ 快捷键说明

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