Exemple #1
0
int RunTraceWrapper(int write, int read, int address, int data)
{
	cacheTrace trace;
	
	trace.write = write;
	trace.read = read;
	trace.address = address;
	trace.data = data;
	
	return runTrace(trace);
}
void PathPlanner::mainMenu(){
	cout<<"\n\nWelcome to Eric's Caffeine Induced Path Planner!\n";
	
	bool choiceFlag= true;
	string choice;

	while(choiceFlag){
		cout<<"Please select from the following menu options.\n\n";
		cout<<"1: Run Inner Trace Algorithm\n";
		cout<<"2: Run a silly Square Spiral\n";
		cout<<"3: Run a Rapidly Exploring Random Tree Search Algorithm\n";

		cin>>choice;
		if(isdigit(choice[0])){
			//Really dirty hack to get the int value. Im sorry :(
			int option= choice[0] - '0';
			switch(option){
				case 1:
				runTrace();
				break;

				case 2:
				runSquareSpiral();
				break;
				
				case 3:
				runRRT();
				break;
			}
		}
		else if(choice[0] == 'q' || choice[0] =='Q'){
			cout<<"\n\nThanks for using Eric's Caffeine Induced Path Planner!\n";
			cout<<"Bye\n";
			break;
		}
		else{
			cout<<"Please enter a number listed on the options menu!\n";
		}
	}
}