Beruflich Dokumente
Kultur Dokumente
MACHINE PROJECT
CS10L/COMPUTER SCIENCE LABORATORY
Submitted by: Barrientos, Lei Anne Catenza, Lorraine Gavino, Regina Lim, Tinnie Maglaki, Trixie Julianne
I.
Machine Program Statement The program is entitled Memory Game. The program will contain ten levels, wherein in each level, there will be a statement that will be displayed for a certain time, and will disappear afterwards. The user needs to input the same statement, with the proper punctuations and capitalizations observed, until one reaches level ten.
II.
Objective/s The main objective of the game is to enhance the memory skills of the user into familiarizing long, substantial statements.
III.
Data Dictionary Functions Description Main function of the program Function for timer Function that outputs the statements
Variables Local to Description int main () Level of the game int main () Default starting time for timer int main () Starter of the game int main () Container for the answer of the user void print () Variable for the array
IV.
Program Flowchart
V.
Screenshots
VI.
void wait( int seconds ) { clock_t endwait; endwait = clock () + seconds * CLOCKS_PER_SEC ; while (clock() < endwait) {} system("cls"); }
void print( int lv , int time ) { time *= lv; cout << "Memorize the phrase in " << time << " seconds \n"; cout << phrases[lv - 1]; wait( time ); } int main() { int lvl = 1 , time = 3; char yn; string answer; cin >> yn; system("cls"); do{ print ( lvl , time ); getline (cin,answer); if ( answer == phrases[ lvl - 1 ] ){ lvl += 1 ; continue; } else lvl = 1; if (lvl == 10) break; } while (lvl != 10); cout << " Do you want to retry the game (y/n)?: "; cin >> yn; if ( yn == 'y') main(); else if ( yn == 'n' ) return 0; else {cin >> yn; return 0;} }
VII.
Group Contribution Member s Name Regina Gavino Trixie Maglaki Tinnie Lim Lorraine Catenza Lei Barrientos Contribution Flowchart, encoding, paperworks, CD burning Encoding Encoding Encoding, paperworks Encoding, paperworks Module Programmed Compiled all the functions into one Wait function and Print function Wait function and Print function Main function Main function