100% found this document useful (3 votes)
2K views10 pages

Computer Investigatory Project CBSE Class 12

This document is Sidharth M's computer science investigatory project on "The Memory Game" submitted to Kendriya Vidyalaya No. 2 in Puducherry, India. It includes an acknowledgment thanking those who helped with the project, source code for a memory game program written in C++ using graphics functions, and a bibliography listing online resources consulted. The program generates random numbers for the user to remember and input in the correct order to progress to higher levels, keeping score along the way.

Uploaded by

sidharth1196
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
2K views10 pages

Computer Investigatory Project CBSE Class 12

This document is Sidharth M's computer science investigatory project on "The Memory Game" submitted to Kendriya Vidyalaya No. 2 in Puducherry, India. It includes an acknowledgment thanking those who helped with the project, source code for a memory game program written in C++ using graphics functions, and a bibliography listing online resources consulted. The program generates random numbers for the user to remember and input in the correct order to progress to higher levels, keeping score along the way.

Uploaded by

sidharth1196
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

PONDICHERRY UNIVERSITY CAMPUS, KALAPET, PUDUCHERRY

KENDRIYA VIDYALAYA NO.2

COMPUTER SCIENCE INVESTIGATORY PROJECT 2013-2014 -The Memory Game-

SUBMITTED BY SIDHARTH M XII

1|Page

BONAFIDE CERTIFICATE
Certified that this is a bonafide record of project work done by Sidharth M of Kendriya Vidyalaya No.2, Pondicherry University Campus, Kalapet, Puducherry during the academic year 2013-2014.

Internal Examiner signature

External Examiner signature

Principals signature
2|Page

ACKNOWLEDGEMENT
I wish to express my deep gratitude and sincere thanks to Principal, Mr. Sampath Kumar, Kendriya Vidyalaya No.2, Pondicherry, for his encouragement and for all the facilities that he provided for this project work. I sincerely appreciate this magnanimity by taking me into his fold for which I shall remain indebted to him. I extend my hearty thanks to Mr. Praveen Kumar , Computer Science teacher, who guided me to the successful completion of this project. I take this opportunity to express my deep sense of gratitude for her invaluable guidance, constant encouragement, constructive comments, sympathetic attitude and immense motivation, which has sustained my efforts at all stages of this project work. I cant forget to offer my sincere thanks to my classmates who helped me to carry out this project work successfully & for their valuable advice & support, which I received from them time to time.

3|Page

SOURCE CODE:
//THE MEMORY GAME #include<graphics.h> #include<dos.h> #include<fstream.h> #include<conio.h> #include<stdlib.h> int a[10],c[10],point=0,flag=1,p[50],s; char ans='y',con; int compare(int); int mem_game (int); void rec(); void main() { clrscr(); int ch; int gdriver = DETECT, gmode; initgraph(&gdriver, &gmode, "c:\\TC\\BGI"); start: clrscr(); settextstyle(1,0,3); setcolor(1); outtextxy(125,100,"THE MEMORY GAME"); outtextxy(60,175,"1.Play Game 2.High Scores 3.Instructions 4.Exit"); cin>>ch; switch(ch)

4|Page

{ case 1: { for(int y=3;y<10;y++) { clrscr(); cout<<"Level "<<y-2<<endl;sleep(1); if(y==3)point=0; mem_game(y); clrscr(); s=compare(y); if(s==0)goto start; mem_game(y); clrscr(); s=compare(y); if(s==0)goto start; clrscr(); cout<<"Level "<<y-2<<" cleared!"<<endl; sleep(1); clrscr(); } Cout<<Thank you for playing the game !<<endl; sleep(1); break; } case 2: { int big,pos,tmp,i=0; fstream pt("Hscore.txt",ios::in); while(!pt.eof()) { pt>>p[i];

5|Page

i++; } for(int j=0;j<i;j++) { big=p[i]; pos=i; for(int k=j+1;k<i;k++) { if(p[k]>big) {big=p[k]; pos=k;} } tmp=p[j]; p[j]=p[pos]; p[pos]=tmp; } clrscr(); for(j=0;j<i;j++) cout<<j+1<<" . "<<p[j]<<endl; sleep(3); goto start; } case 3: clrscr(); cout<<"\tHello. This is a very simple. A list of numbers will be printed and the player has to keep them in mind and reproduce them when asked.\nFor every correct answer the player gets awarded 10 points .If the player makes one wrong input he/she is out.\nHave Fun! "<<endl; cout<<"\n\nEnter y to continue"<<endl; cin>>con; if(con=='y'||con=='Y') goto start; else goto start; case 4: clrscr(); 6|Page

break; default : clrscr(); cout<<"Wrong choice! Restarting";sleep(2); goto start; } clrscr(); getch(); } int mem_game(int n) { randomize(); int x; for(int i=0;i<n;i++) { x=random(9)+1; c[i]=x; clrscr(); switch(x) { case 1:rec();settextstyle(1,0,3);outtextxy(225,115,"1");sleep(1);clrscr();rec();break; case 2:rec();settextstyle(1,0,3);outtextxy(291,115,"2");sleep(1);clrscr();rec();break; case 3:rec();settextstyle(1,0,3);outtextxy(357,115,"3");sleep(1);clrscr();rec();break; case 4:rec();settextstyle(1,0,3);outtextxy(225,181,"4");sleep(1);clrscr();rec();break; case 5:rec();settextstyle(1,0,3);outtextxy(291,181,"5");sleep(1);clrscr();rec();break; case 6:rec();settextstyle(1,0,3);outtextxy(357,181,"6");sleep(1);clrscr();rec();break; case 7:rec();settextstyle(1,0,3);outtextxy(225,247,"7");sleep(1);clrscr();rec();break; case 8:rec();settextstyle(1,0,3);outtextxy(291,247,"8");sleep(1);clrscr();rec();break; case 9:rec();settextstyle(1,0,3);outtextxy(357,247,"9");sleep(1);clrscr();rec();break; }

7|Page

} return 0; } int compare(int n) { int i=0; cout<<"Enter the numbers in the correct order : "<<endl; while(i<n) { cin>>a[i]; if(a[i]!=c[i]) { cout<<"Wrong!!! GAME OVER!\n"; cout<<"Score : "<<point; flag=0; fstream pt("Hscore.txt",ios::out|ios::app); pt<<point<<endl; pt.close(); sleep(4); return 0; } else point+=10; i++; } return 1; }

8|Page

void rec() { rectangle(200,100,400,300); rectangle(200,100,266,300); rectangle(200,100,332,300); rectangle(200,100,400,166); rectangle(200,166,400,232); rectangle(200,232,400,300); }

9|Page

BIBLIOGRAPHY:
www.google.com www.programmingsimplified.com www.youtube.com

10 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy