I moved on to switch cases, and I found that they are easier than they sounded. For lack of a better example, they are like program menus. Here is a chunk of code:
What happens is you enter a number between 1-4 and whatever one you choose, it will run that case. If you pick something other than that, it will display a default message. Currently, I've gotten the cases to work, but the default doesn't work. Another problem is that the message (ie. You chose 4) doesn't stay. It quickly displays and then the window closes. That should be easily solved, but I didn't have time to solve it because...
switch ( input ) {
case 1:
cout<<"You chose 1.";
break;
case 2:
cout<<"You chose 2.";
break;
case 3:
cout<<"You chose 3.";
break;
case 4:
cout<<"You chose 4.";
break;
default:
cout<<"Why can't you follow directions?";
break;
}
The second half of the double period was a presentation of Zhanar's Sudoku Solver. We proved that, when solving a sudoku, I am smarter than a computer. That might be an incentive for her to make a logical Sudoku Solver, for the way that her current program works doesn't use logic. We went through the code and Zhanar explained what everything did. I didn't necessarily understand what all the code did, but I was able to understand the basic functions of each bit when explained. It was a good presentation.
No comments:
Post a Comment