├── Bank Management system.CPP ├── Calender 1990 to 2070.CPP ├── Calender as usual format.CPP ├── Eight Queen Game.CPP ├── Game of BOLLYWOOD.c ├── Guess the correct Number.CPP ├── Modify version of Quiz.CPP ├── Perodic Table.CPP ├── QUIZ.C ├── README.md ├── Student Management system.CPP ├── Sudoku.CPP └── Tic Tac Toe Game(unbeatable).CPP /Bank Management system.CPP: -------------------------------------------------------------------------------- 1 | //Bank Management system 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | class A 8 | { int c,wm,d,e; 9 | double am; 10 | char s1[20],s2[20],s3[15],s4[20],s5[500],s6[10],s7[15]; 11 | public: 12 | void B() 13 | { cout<<"Enter Name: "; 14 | gets(s1); 15 | cout<<"Enter Father's Name: "; 16 | gets(s2); 17 | cout<<"Enter Date of Birth(dd/mm/yyyy): "; 18 | cin>>s3; 19 | cout<<"Enter Nationality: "; 20 | cin>>s4; 21 | cout<<"Enter Address of Residance: "; 22 | gets(s5); 23 | cout<<"Enter Mobile Number: "; 24 | cin>>s7; 25 | cout<<"Enter Amount to be Deposit: "; 26 | cin>>am; 27 | cout<<"Enter Type of Account-Saving or Current: "; 28 | cin>>s6; 29 | cout<<"Enter Citizenship Number :"; 30 | cin>>c; 31 | } 32 | void C() 33 | { cout<<"Name: "<>ch; 61 | if(ch=='y'||ch=='Y') 62 | { cout<<"\nWhat you want to change\n"; 63 | cout<<"1.Name\n2.Father's Name\n3.DOB\n4.Address\n5.Mobile Number\n\n"; 64 | cout<<"Enter your choice: "; 65 | cin>>b; 66 | switch(b) 67 | { case 1: cout<<"\nEnter New Name:"; 68 | gets(s1); 69 | break; 70 | case 2: cout<<"\nEnter New Father's Name: "; 71 | gets(s2); 72 | break; 73 | case 3: cout<<"\nEnter Date of Birth: "; 74 | cin>>s3; 75 | break; 76 | case 4: cout<<"\nEnter Address of Residance: "; 77 | gets(s5); 78 | break; 79 | case 5: cout<<"\nEnter Mobile Number: "; 80 | cin>>s7; 81 | break; 82 | default: cout<<"\nWrong Choice"; 83 | break; 84 | } 85 | } 86 | else 87 | { cout<<"\nYou not want to Modify the Record"; 88 | l=1; 89 | } 90 | return(l); 91 | } 92 | void F() 93 | { int z,t,t1; 94 | e=0; 95 | wm=0; 96 | d=0; 97 | cout<<"Name: "<>z; 109 | switch(z) 110 | { case 1: cout<<"\nWithdrawing the Amount\n"; 111 | cout<<"You having "<>wm; 114 | if(wm>am) 115 | { cout<<"\nYou cannot Wihdraw the Amount of "<>d; 129 | t=am+d; 130 | am=t; 131 | cout<<"\nYour Amount is successfully Deposited\n"; 132 | cout<<"You have "<>x; 177 | switch(x) 178 | { case 1: clrscr(); 179 | cout<<"Creating a New Account\n\n"; 180 | ofstream outfile1; 181 | outfile1.open("bank.dat",ios::app|ios::binary); 182 | obj.B(); 183 | outfile1.write((char*)&obj,sizeof(obj)); 184 | outfile1.close(); 185 | cout<<"\n\nDetails that you have added\n\n"; 186 | obj.C(); 187 | getch(); 188 | break; 189 | case 2: int f=0; 190 | clrscr(); 191 | cout<<"Searching the Details of Customer Account\n\n"; 192 | ifstream infile2; 193 | infile2.open("bank.dat",ios::in|ios::binary); 194 | cout<<"Enter Citizenshipship Number to Search: "; 195 | cin>>r; 196 | while(infile2.read((char*)&obj,sizeof(obj))) 197 | { rn=obj.D(); 198 | if(rn==r) 199 | { cout<<"\nRecord found !!!\n\n"; 200 | obj.C(); 201 | f=1; 202 | getch(); 203 | break; 204 | } 205 | } 206 | infile2.close(); 207 | if(f==0) 208 | cout<<"\nSorry ! Record Not Found\n"; 209 | getch(); 210 | break; 211 | case 3: int y=0; 212 | clrscr(); 213 | cout<<"Editing the Customer Account\n\n"; 214 | fstream inout; 215 | inout.open("bank.dat",ios::out|ios::in|ios::binary); 216 | cout<<"Enter Citizenship Number of the record you want to Modify: "; 217 | cin>>r1; 218 | while(inout) 219 | { pos=inout.tellg(); 220 | inout.read((char*)&obj,sizeof(obj)); 221 | rn1=obj.D(); 222 | if(rn1==r1) 223 | { k=obj.E(); 224 | y=1; 225 | inout.seekg(pos); 226 | inout.write((char*)&obj,sizeof(obj)); 227 | getch(); 228 | if(k==0) 229 | { cout<<"\nRecord Modified Successfully"; 230 | getch(); 231 | clrscr(); 232 | cout<<"Modify Record is shown below-\n\n"; 233 | obj.C(); 234 | getch(); 235 | } 236 | break; 237 | } 238 | } 239 | inout.close(); 240 | if(y==0) 241 | cout<<"\nSorry ! Record not Found"; 242 | getch(); 243 | break; 244 | case 4: int u=0,u1=0; 245 | clrscr(); 246 | cout<<"Transction\n\n"; 247 | fstream inout1; 248 | inout1.open("bank.dat",ios::out|ios::in|ios::binary); 249 | cout<<"Enter Citizenship Number: "; 250 | cin>>cn; 251 | while(inout1) 252 | { pos=inout1.tellg(); 253 | inout1.read((char*)&obj,sizeof(obj)); 254 | c2=obj.D(); 255 | if(cn==c2) 256 | { cout<<"\n"; 257 | obj.F(); 258 | inout1.seekg(pos); 259 | inout1.write((char*)&obj,sizeof(obj)); 260 | u=1; 261 | u1=1; 262 | getch(); 263 | break; 264 | } 265 | } 266 | inout1.close(); 267 | if(u1==0) 268 | e1=1; 269 | else 270 | e1=obj.K(); 271 | if(e1!=1) 272 | { ofstream outfile4; 273 | outfile4.open("bank1.dat",ios::app|ios::binary); 274 | obj.D(); 275 | obj.G(); 276 | obj.H(); 277 | outfile4.write((char*)&obj,sizeof(obj)); 278 | outfile4.close(); 279 | } 280 | if(u==0) 281 | cout<<"\nSorry ! Record not Found"; 282 | getch(); 283 | break; 284 | case 5: int g=0; 285 | clrscr(); 286 | cout<<"Deleting the customer Account\n\n"; 287 | ofstream outfile2; 288 | outfile2.open("temp.dat",ios::out|ios::binary); 289 | ifstream infile4; 290 | infile4.open("bank.dat",ios::out|ios::binary); 291 | cout<<"Enter Citizenship number of the record you want to delete: "; 292 | cin>>r2; 293 | while(infile4.read((char*)&obj,sizeof(obj))) 294 | { rn2=obj.D(); 295 | if(rn2==r2) 296 | { g=1; 297 | cout<<"\nThe record you want to delete is:\n\n"; 298 | obj.C(); 299 | cout<<"\nAre you sure to delete the record(Y/N):"; 300 | cin>>d; 301 | if(d=='n'||d=='N') 302 | { outfile2.write((char*)&obj,sizeof(obj)); 303 | cout<<"\nThe Account is not deleted"; 304 | } 305 | else 306 | cout<<"\nCustomer Account successfully Deleted"; 307 | } 308 | else 309 | outfile2.write((char*)&obj,sizeof(obj)); 310 | } 311 | if(g==0) 312 | cout<<"\nSorry ! The Record you want to delete is not Found"; 313 | outfile2.close(); 314 | infile4.close(); 315 | remove("bank.dat"); 316 | rename("temp.dat","bank.dat"); 317 | getch(); 318 | break; 319 | case 6: int f1=0; 320 | clrscr(); 321 | cout<<"See whole Details of Customer Account\n\n"; 322 | ifstream infile5; 323 | infile5.open("bank.dat",ios::in|ios::binary); 324 | cout<<"Enter Citizenshipship Number to Search: "; 325 | cin>>r2; 326 | while(infile5.read((char*)&obj,sizeof(obj))) 327 | { rn3=obj.D(); 328 | if(rn3==r2) 329 | { cout<<"\nRecord found !!!\n\n"; 330 | ifstream infile3; 331 | infile3.open("bank1.dat",ios::in|ios::binary); 332 | obj.C(); 333 | cout<<"\n"; 334 | while(infile3.read((char*)&obj,sizeof(obj))) 335 | { rn3=obj.D(); 336 | if(rn3==r2) 337 | { obj.I(); 338 | cout<<"\n"; 339 | obj.J(); 340 | cout<<"\n"; 341 | getch(); 342 | } 343 | } 344 | infile3.close(); 345 | //obj.C(); 346 | f1=1; 347 | getch(); 348 | break; 349 | } 350 | } 351 | infile5.close(); 352 | if(f1==0) 353 | cout<<"\nSorry ! Record Not Found\n"; 354 | getch(); 355 | break; 356 | case 7: cout<<"EXIT"; 357 | break; 358 | default: cout<<"Wrong choice"; 359 | getch(); 360 | break; 361 | } 362 | } 363 | getch(); 364 | } 365 | -------------------------------------------------------------------------------- /Calender 1990 to 2070.CPP: -------------------------------------------------------------------------------- 1 | //Calender 1990 to 2070 2 | #include 3 | #include 4 | #define G 5000 5 | #define F for(k=1;k<=G;k++)\ 6 | { if(i==7*k-6)\ 7 | printf("Monday");\ 8 | if(i==7*k-5)\ 9 | printf("Tuesday");\ 10 | if(i==7*k-4)\ 11 | printf("Wednesday");\ 12 | if(i==7*k-3)\ 13 | printf("Thursday");\ 14 | if(i==7*k-2)\ 15 | printf("Friday");\ 16 | if(i==7*k-1)\ 17 | printf("Saturday");\ 18 | if(i==7*k)\ 19 | printf("Sunday");\ 20 | } 21 | void main() 22 | { clrscr(); 23 | int d,m,y,i,k,j,z,f=0,a,g=0; 24 | printf("Enter date="); 25 | scanf("%d",&d); 26 | printf("Enter month="); 27 | scanf("%d",&m); 28 | printf("Enter year="); 29 | scanf("%d",&y); 30 | for(j=0;j<=90;j++) 31 | { if(y==1990+j) 32 | { z=j*365; 33 | if(m==2&&d==29) 34 | g=1; 35 | if(m==1) 36 | a=0; 37 | if(m==2) 38 | a=31; 39 | if(m==3) 40 | a=59; 41 | if(m==4) 42 | a=89; 43 | if(m==5) 44 | a=120; 45 | if(m==6) 46 | a=151; 47 | if(m==7) 48 | a=181; 49 | if(m==8) 50 | a=212; 51 | if(m==9) 52 | a=242; 53 | if(m==10) 54 | a=273; 55 | if(m==11) 56 | a=303; 57 | if(m==12) 58 | a=334; 59 | i=d+z+a; 60 | if(i>=1&&i<=789) 61 | f=0; 62 | if(i>=790&&i<=2249) 63 | f=1; 64 | if(i>=2250&&i<=3709) 65 | f=2; 66 | if(i>=3710&&i<=5169) 67 | f=3; 68 | if(i>=5170&&i<=6629) 69 | f=4; 70 | if(i>=6630&&i<=8089) 71 | f=5; 72 | if(i>=8090&&i<=9549) 73 | f=6; 74 | if(i>=9550&&i<=11009) 75 | f=7; 76 | if(i>=11010&&i<=12469) 77 | f=8; 78 | if(i>=12470&&i<=13929) 79 | f=9; 80 | if(i>=13930&&i<=15389) 81 | f=10; 82 | if(i>=15390&&i<=16849) 83 | f=11; 84 | if(i>=16850&&i<=18309) 85 | f=12; 86 | if(i>=18310&&i<=19769) 87 | f=13; 88 | if(i>=19770&&i<=21229) 89 | f=14; 90 | if(i>=21230&&i<=22689) 91 | f=15; 92 | if(i>=22670&&i<=24149) 93 | f=16; 94 | if(i>=24150&&i<=25609) 95 | f=17; 96 | if(i>=25610&&i<=27069) 97 | f=18; 98 | if(i>=27070&&i<=28529) 99 | f=19; 100 | if(i>=28530&&i<=29989) 101 | f=20; 102 | if(i>=29990&&i<=31449) 103 | f=21; 104 | if(i>=31450&&i<=32909) 105 | f=22; 106 | if(i>=32910&&i<=34369) 107 | f=23; 108 | { if(m==1) 109 | { for(i=1+z+f;i<=31+z+f;i++) 110 | { if(d+z+f==i) 111 | { F; 112 | } 113 | } 114 | } 115 | if(m==2) 116 | { for(i=32+z+f;i<=59+z+f;i++) 117 | { if(d+31+z+f-g==i) 118 | { F; 119 | } 120 | } 121 | } 122 | if(m==3) 123 | { for(i=60+z+f;i<=90+z+f;i++) 124 | { if(d+59+z+f==i) 125 | { F; 126 | } 127 | } 128 | } 129 | if(m==4) 130 | { for(i=91+z+f;i<=120+z+f;i++) 131 | { if(d+90+z+f==i) 132 | { F; 133 | } 134 | } 135 | } 136 | if(m==5) 137 | { for(i=121+z+f;i<=151+z+f;i++) 138 | { if(d+120+z+f==i) 139 | { F; 140 | } 141 | } 142 | } 143 | if(m==6) 144 | { for(i=152+z+f;i<=181+z+f;i++) 145 | { if(d+151+z+f==i) 146 | { F; 147 | } 148 | } 149 | } 150 | if(m==7) 151 | { for(i=182+z+f;i<=212+z+f;i++) 152 | { if(d+181+z+f==i) 153 | { F; 154 | } 155 | } 156 | } 157 | if(m==8) 158 | { for(i=213+z+f;i<=243+z+f;i++) 159 | { if(d+212+z+f==i) 160 | { F; 161 | } 162 | } 163 | } 164 | if(m==9) 165 | { for(i=244+z+f;i<=273+z+f;i++) 166 | { if(d+243+z+f==i) 167 | { F; 168 | } 169 | } 170 | } 171 | if(m==10) 172 | { for(i=274+z+f;i<=304+z+f;i++) 173 | { if(d+273+z+f==i) 174 | { F; 175 | } 176 | } 177 | } 178 | if(m==11) 179 | { for(i=305+z+f;i<=334+z+f;i++) 180 | { if(d+304+z+f==i) 181 | { F; 182 | } 183 | } 184 | } 185 | if(m==12) 186 | { for(i=335+z+f;i<=365+z+f;i++) 187 | { if(d+334+z+f==i) 188 | { F; 189 | } 190 | } 191 | } 192 | } 193 | } 194 | } 195 | getch(); 196 | } -------------------------------------------------------------------------------- /Calender as usual format.CPP: -------------------------------------------------------------------------------- 1 | //Calender 2 | #include 3 | #include 4 | void main() 5 | { clrscr(); 6 | int m,y,i,j,k,l,y1=0,p,q,r,f,s=0; 7 | printf("Enter Month="); 8 | scanf("%d",&m); 9 | printf("Enter Year="); 10 | scanf("%d",&y); 11 | for(l=1990;l=1&&q<=789) 76 | f=0; 77 | if(q>=790&&q<=2249) 78 | f=1; 79 | if(q>=2250&&q<=3709) 80 | f=2; 81 | if(q>=3710&&q<=5169) 82 | f=3; 83 | if(q>=5170&&q<=6629) 84 | f=4; 85 | if(q>=6630&&q<=8089) 86 | f=5; 87 | if(q>=8090&&q<=9549) 88 | f=6; 89 | if(q>=9550&&q<=11009) 90 | f=7; 91 | if(q>=11010&&q<=12469) 92 | f=8; 93 | if(q>=12470&&q<=13929) 94 | f=9; 95 | if(q>=13930&&q<=15389) 96 | f=10; 97 | if(q>=15390&&q<=16849) 98 | f=11; 99 | if(q>=16850&&q<=18309) 100 | f=12; 101 | if(q>=18310&&q<=19769) 102 | f=13; 103 | if(q>=19770&&q<=21229) 104 | f=14; 105 | if(q>=21230&&q<=22689) 106 | f=15; 107 | if(q>=22670&&q<=24149) 108 | f=16; 109 | if(q>=24150&&q<=25609) 110 | f=17; 111 | if(q>=25610&&q<=27069) 112 | f=18; 113 | if(q>=27070&&q<=28529) 114 | f=19; 115 | if(q>=28530&&q<=29989) 116 | f=20; 117 | if(q>=29990&&q<=31449) 118 | f=21; 119 | if(q>=31450&&q<=32909) 120 | f=22; 121 | if(q>=32910&&q<=34369) 122 | f=23; 123 | q=q+f; 124 | r=r+f; 125 | if(q%7-1==0) 126 | p=q; 127 | if(q%7-2==0) 128 | p=q-1; 129 | if(q%7-3==0) 130 | p=q-2; 131 | if(q%7-4==0) 132 | p=q-3; 133 | if(q%7-5==0) 134 | p=q-4; 135 | if(q%7-6==0) 136 | p=q-5; 137 | if(q%7==0) 138 | p=q-6; 139 | printf("\nMon Tue Wed Thru Fri Sat Sun\n"); 140 | for(i=1;i<=6;i++) 141 | { for(j=1;j<=7;j++) 142 | { if(m==1) 143 | { if(0 3 | #include 4 | #include 5 | class A 6 | { int i,j,a[10][10],n,p,q,r,c,e; 7 | public: 8 | A() 9 | { n=1; 10 | e=0; 11 | } 12 | void B() 13 | { for(i=0;i<10;i++) 14 | { for(j=0;j<10;j++) 15 | a[i][j]=0; 16 | } 17 | } 18 | void D() 19 | { e=0; 20 | clrscr(); 21 | cout<<"\t\tEIGHT QUEEN\n"; 22 | cout<<"\t\t~~~~~~~~~~~~\n\n\n"; 23 | for(i=0;i<9;i++) 24 | { for(j=0;j<9;j++) 25 | { if(a[i][j]==0) 26 | cout<<"|_"<<" _"; 27 | else 28 | { cout<<"|_"<q) 76 | { p=p-q; 77 | q=0; 78 | } 79 | else if(q>p) 80 | { q=q-p; 81 | p=0; 82 | } 83 | else 84 | { p=0; 85 | q=0; 86 | } 87 | for(i=0;i<9;i++) 88 | { if(a[p][q]==n) 89 | { cout<<"Wrong Input,There is element in a right diagonal"; 90 | getch(); 91 | C(); 92 | } 93 | if(p<9&&q<9) 94 | { p++; 95 | q++; 96 | } 97 | } 98 | p=r; 99 | q=c; 100 | for(i=0;i<9;i++) 101 | { if(a[p][q]==n) 102 | { cout<<"Wrong Input,There is element in a left diagonal"; 103 | getch(); 104 | C(); 105 | } 106 | if(p>0&&q<9) 107 | { p--; 108 | q++; 109 | } 110 | } 111 | p=r; 112 | q=c; 113 | for(i=0;i<9;i++) 114 | { if(a[p][q]==n) 115 | { cout<<"Wrong Input,There is element in a left diagonal"; 116 | getch(); 117 | C(); 118 | } 119 | if(p<9&&q>0) 120 | { p++; 121 | q--; 122 | } 123 | } 124 | a[r][c]=n; 125 | D(); 126 | } 127 | void E() 128 | { int w=0,x; 129 | clrscr(); 130 | cout<<"\t\tEIGHT QUEEN\n"; 131 | cout<<"\t\t~~~~~~~~~~~~\n\n\n"; 132 | cout<<"1.New Game"<>x; 138 | switch(x) 139 | { case 1: w=1; 140 | clrscr(); 141 | B(); 142 | D(); 143 | break; 144 | case 2: w=1; 145 | clrscr(); 146 | cout<<"\t\tINSTRUCTIOMS\n\n"; 147 | cout<<"1.The aim of the puzzle is to enter a digit from 1 to 9.\n"; 148 | cout<<"2.In each cell of a 9X9 grid made up of 3X3 subgrids.\n"; 149 | cout<<"3.In each row,column,and subgrid must contain only one instance of each digit.\n"; 150 | cout<<"4.For seeing the solution of given Sudoku puzzle press number '10' in row and press Enter button.\n"; 151 | cout<<"\nPress enter button to start Sudoku puzzle"; 152 | getch(); 153 | B(); 154 | D(); 155 | clrscr(); 156 | break; 157 | case 3: exit(0); 158 | default: cout<<"Wrong Input"< 3 | #include 4 | #include 5 | #include 6 | #include 7 | void main() 8 | { char s1[50],s2[50],s3[50],s4[500],c,ch='y'; 9 | int i,j,p,z,q,l,a,b; 10 | time_t t; 11 | clrscr(); 12 | time(&t); 13 | srand((unsigned int) t); 14 | while(ch=='Y'||ch=='y') 15 | { for(l=0;l<1;l++) 16 | { b=rand()%10; 17 | if(b==0) 18 | a=rand()%10; 19 | if(b==1) 20 | a=rand()%10+5; 21 | if(b==2) 22 | a=rand()%10+10; 23 | if(b==3) 24 | a=rand()%10+15; 25 | if(b==4) 26 | a=rand()%10+20; 27 | if(b==5) 28 | a=rand()%10+25; 29 | if(b==6) 30 | a=rand()%10+30; 31 | if(b==7) 32 | a=rand()%10+35; 33 | if(b==8) 34 | a=rand()%10+40; 35 | if(b==9) 36 | a=rand()%10+45; 37 | if(a==0) 38 | { char s4[]="KRRISH"; 39 | strcpy(s1,s4); 40 | } 41 | if(a==1) 42 | { char s4[]="MAIN/HOON/HERO/TERA"; 43 | strcpy(s1,s4); 44 | } 45 | if(a==2) 46 | { char s4[]="PREM/RATAN/DHAN/PAAYO"; 47 | strcpy(s1,s4); 48 | } 49 | if(a==3) 50 | { char s4[]="BAJRANGI/BHAIJAAN"; 51 | strcpy(s1,s4); 52 | } 53 | if(a==4) 54 | { char s4[]="HAPPY/NEW/YEAR"; 55 | strcpy(s1,s4); 56 | } 57 | if(a==5) 58 | { char s4[]="MAIN/TERA/HERO"; 59 | strcpy(s1,s4); 60 | } 61 | if(a==6) 62 | { char s4[]="KHAMOSHIYA"; 63 | strcpy(s1,s4); 64 | } 65 | if(a==7) 66 | { char s4[]="SONALI/CABLE"; 67 | strcpy(s1,s4); 68 | } 69 | if(a==8) 70 | { char s4[]="AJAB/PREM/KI/GHAZAB/KAHANI"; 71 | strcpy(s1,s4); 72 | } 73 | if(a==9) 74 | { char s4[]="HAMARI/ADHURI/KAHANI"; 75 | strcpy(s1,s4); 76 | } 77 | if(a==10) 78 | { char s4[]="MAINE/PAYAAR/KIYA"; 79 | strcpy(s1,s4); 80 | } 81 | if(a==11) 82 | { char s4[]="DARR/@/MALL"; 83 | strcpy(s1,s4); 84 | } 85 | if(a==12) 86 | { char s4[]="ZANZEER"; 87 | strcpy(s1,s4); 88 | } 89 | if(a==13) 90 | { char s4[]="SHOILAY"; 91 | strcpy(s1,s4); 92 | } 93 | if(a==14) 94 | { char s4[]="JADUGAR"; 95 | strcpy(s1,s4); 96 | } 97 | if(a==15) 98 | { char s4[]="SULTAAN"; 99 | strcpy(s1,s4); 100 | } 101 | if(a==16) 102 | { char s4[]="DEEWAR"; 103 | strcpy(s1,s4); 104 | } 105 | if(a==17) 106 | { char s4[]="BODYGAURD"; 107 | strcpy(s1,s4); 108 | } 109 | if(a==18) 110 | { char s4[]="PREM/ROG"; 111 | strcpy(s1,s4); 112 | } 113 | if(a==19) 114 | { char s4[]="MAIN/PREM/KI/DEEWAMI"; 115 | strcpy(s1,s4); 116 | } 117 | if(a==20) 118 | { char s4[]="PATNER"; 119 | strcpy(s1,s4); 120 | } 121 | if(a==21) 122 | { char s4[]="GAMBLER"; 123 | strcpy(s1,s4); 124 | } 125 | if(a==22) 126 | { char s4[]="BAADAL"; 127 | strcpy(s1,s4); 128 | } 129 | if(a==23) 130 | { char s4[]="SHALAKHE"; 131 | strcpy(s1,s4); 132 | } 133 | if(a==24) 134 | { char s4[]="CHANDAL"; 135 | strcpy(s1,s4); 136 | } 137 | if(a==25) 138 | { char s4[]="DISCO/DANCER"; 139 | strcpy(s1,s4); 140 | } 141 | if(a==26) 142 | { char s4[]="BAJIGAR"; 143 | strcpy(s1,s4); 144 | } 145 | if(a==27) 146 | { char s4[]="SINGH/IS/KING"; 147 | strcpy(s1,s4); 148 | } 149 | if(a==28) 150 | { char s4[]="JHANI/DHUSHMAN"; 151 | strcpy(s1,s4); 152 | } 153 | if(a==29) 154 | { char s4[]="DHARKAN"; 155 | strcpy(s1,s4); 156 | } 157 | if(a==30) 158 | { char s4[]="LOC/KARGAL"; 159 | strcpy(s1,s4); 160 | } 161 | if(a==31) 162 | { char s4[]="GARAM/MASALA"; 163 | strcpy(s1,s4); 164 | } 165 | if(a==32) 166 | { char s4[]="MADARAS/CAFE"; 167 | strcpy(s1,s4); 168 | } 169 | if(a==33) 170 | { char s4[]="RAGINNI/MMS/2"; 171 | strcpy(s1,s4); 172 | } 173 | if(a==34) 174 | { char s4[]="AGNEEPATH"; 175 | strcpy(s1,s4); 176 | } 177 | if(a==35) 178 | { char s4[]="JAB/WE/MET"; 179 | strcpy(s1,s4); 180 | } 181 | if(a==36) 182 | { char s4[]="NAMAK/HALAL"; 183 | strcpy(s1,s4); 184 | } 185 | if(a==37) 186 | { char s4[]="NAYAK"; 187 | strcpy(s1,s4); 188 | } 189 | if(a==38) 190 | { char s4[]="GULAAM"; 191 | strcpy(s1,s4); 192 | } 193 | if(a==39) 194 | { char s4[]="JORU/KA/GULAAM"; 195 | strcpy(s1,s4); 196 | } 197 | if(a==40) 198 | { char s4[]="GANGA/JAL"; 199 | strcpy(s1,s4); 200 | } 201 | if(a==41) 202 | { char s4[]="SARFAROSH"; 203 | strcpy(s1,s4); 204 | } 205 | if(a==42) 206 | { char s4[]="36/CHINA/TOWN"; 207 | strcpy(s1,s4); 208 | } 209 | if(a==43) 210 | { char s4[]="CHACHI/420"; 211 | strcpy(s1,s4); 212 | } 213 | if(a==44) 214 | { char s4[]="LIFE/IN/A/METRO"; 215 | strcpy(s1,s4); 216 | } 217 | if(a==45) 218 | { char s4[]="PAGE/3"; 219 | strcpy(s1,s4); 220 | } 221 | if(a==46) 222 | { char s4[]="DEV/DAS"; 223 | strcpy(s1,s4); 224 | } 225 | if(a==47) 226 | { char s4[]="THE/BURNING/TRAIN"; 227 | strcpy(s1,s4); 228 | } 229 | if(a==48) 230 | { char s4[]="WELCOME"; 231 | strcpy(s1,s4); 232 | } 233 | if(a==49) 234 | { char s4[]="GHATAK"; 235 | strcpy(s1,s4); 236 | } 237 | if(a==50) 238 | { char s4[]="DILL/TO/PAGAL/HE"; 239 | strcpy(s1,s4); 240 | } 241 | if(a==51) 242 | { char s4[]="MERA/NAAM/JOKER"; 243 | strcpy(s1,s4); 244 | } 245 | if(a==52) 246 | { char s4[]="GHAJANI"; 247 | strcpy(s1,s4); 248 | } 249 | if(a==53) 250 | { char s4[]="MR/INDIA"; 251 | strcpy(s1,s4); 252 | } 253 | if(a==54) 254 | { char s4[]="BETA"; 255 | strcpy(s1,s4); 256 | } 257 | if(a==55) 258 | { char s4[]="BORDER"; 259 | strcpy(s1,s4); 260 | } 261 | } 262 | clrscr(); 263 | q=0; 264 | printf("GAME INSTRUCTIONS\n"); 265 | printf("1.You should have to activate the capslock button.\n"); 266 | printf("2.Press the keys onces at a time.\n"); 267 | printf("3.In the following film the vowels are already given to you.\n"); 268 | printf("4.Every wrong input you lose the chances.\n"); 269 | printf("Press Enter for start"); 270 | getch(); 271 | clrscr(); 272 | printf("\t\t\t *******************\n"); 273 | printf("\t\t\t\t\b\b\bBOLLYWOOD\n"); 274 | printf("\t\t\t*******************\n"); 275 | printf("Game Start\n"); 276 | for(p=5;p>0;) 277 | { printf("You have %d chances left for guessing the name of film\n",p); 278 | i=0; 279 | while(s1[i]!='\0') 280 | { if(s1[i]=='A'||s1[i]=='E'||s1[i]=='I'||s1[i]=='O'||s1[i]=='U'||s1[i]==s2[i]||s1[i]=='/') 281 | { s2[i]=s1[i]; 282 | printf("%c",s2[i]); 283 | } 284 | else 285 | { s2[i]='_'; 286 | printf("_"); 287 | } 288 | i++; 289 | } 290 | s2[i]='\0'; 291 | printf("\nEnter a alphabet: "); 292 | scanf("%s",&c); 293 | s3[q]=c; 294 | s3[q+1]='\0'; 295 | z=0; 296 | j=0; 297 | while(s1[j]!='\0') 298 | { if(s1[j]==c) 299 | { s2[j]=s1[j]; 300 | z++; 301 | if(z==1) 302 | { p++; 303 | printf("Correct input\n"); 304 | getch(); 305 | } 306 | else 307 | printf(""); 308 | } 309 | j++; 310 | } 311 | if(z==0) 312 | { printf("Wrong input\n"); 313 | getch(); 314 | } 315 | p--; 316 | clrscr(); 317 | printf("\t\t\t*******************\n"); 318 | printf("\t\t\t\t\b\b\bBOLLYWOOD\n"); 319 | printf("\t\t\t*******************\n"); 320 | printf("Game Start\n"); 321 | printf("You used these alphabets: %s\n",s3); 322 | if(strcmp(s1,s2)==0) 323 | { clrscr(); 324 | printf("The name of film you enters is correct\n"); 325 | printf("The name of film is:\n"); 326 | puts(s1); 327 | printf("YOU WON\n"); 328 | printf("THANK YOU FOR PLAYING BOLLYWOOD\n"); 329 | printf("MADE BY- SHASHANK"); 330 | getch(); 331 | break; 332 | } 333 | q++; 334 | } 335 | if(p==0) 336 | { clrscr(); 337 | printf("YOU LOSE\n"); 338 | printf("The name of film is:\n"); 339 | puts(s1); 340 | printf("THANK YOU FOR PLAYING BOLLYWOOD\n"); 341 | printf("MADE BY- SHASHANK"); 342 | getch(); 343 | } 344 | printf("\nDo you want to continue this game(Y/N): "); 345 | fflush(stdin); 346 | scanf("%c",&ch); 347 | } 348 | getch(); 349 | } -------------------------------------------------------------------------------- /Guess the correct Number.CPP: -------------------------------------------------------------------------------- 1 | //Guess the correct Number 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | class A 9 | { int n,r,c,i; 10 | char ch,s[25]; 11 | public: 12 | A() 13 | { c=8; 14 | ch='y'; 15 | } 16 | void B() 17 | { int w=0,x; 18 | clrscr(); 19 | cout<<"\t\t\tGuess the correct Number\n"; 20 | cout<<"\t\t\t~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n"; 21 | cout<<"----------------\n"; 22 | cout<<" Main Menu \n"; 23 | cout<<"----------------\n\n"; 24 | cout<<"1.New Game\n"<>x; 30 | switch(x) 31 | { case 1: w=1; 32 | clrscr(); 33 | C(); 34 | D(); 35 | break; 36 | case 2: w=1; 37 | clrscr(); 38 | cout<<"\n\n---------------------"<<"\n General Description"<<"\n---------------------"; 39 | cout<<"\n\n1.The Computer picks a random number from 0 to 99.\n You must try to guess the number."; 40 | cout<<"\n\n2.The Computer ask you to enter your guess.You have 8\n chances to guess the number."; 41 | cout<<"\n\n3.The computer checks the number,if your guess is\n less than computer's numer than it will show a message\n that your guess is low and ask for higher number."; 42 | cout<<"\n\n4.If your guess is higher than the computer's number\n than computer will show a message that your guess is high and\n ask for lower number."; 43 | cout<<"\n\n5.If your guess is equal to the computer's number,than\n computer will print a message congratulating you\n and will ask you to play the game again or exit."; 44 | cout<<"\n\n6.If you are unable to guess the number than the computer\n will a sorry message and ask you to play the game again or exit.\n"; 45 | cout<<"\n\n Press enter button to start the game"; 46 | getch(); 47 | clrscr(); 48 | C(); 49 | D(); 50 | break; 51 | case 3: exit(0); 52 | default: cout<<"\nWrong Input\n"<>n; 70 | if(r==n) 71 | { cout<<"\nYou Guess the correct Number\n"; 72 | delay(5000); 73 | clrscr(); 74 | cout<<"\n\nCongrulation you win the game\n\n"; 75 | cout<<"THANK YOU FOR PLAYING THE GAME\n\n"; 76 | cout<<"MADE BY- SHASHANK "; 77 | delay(8000); 78 | exit(0); 79 | } 80 | else if(r>n) 81 | { cout<<"\nIt is Low......!!\n"<>ch; 100 | if(ch=='y'||ch=='Y') 101 | { clrscr(); 102 | c=8; 103 | D(); 104 | } 105 | } 106 | exit(0); 107 | } 108 | cout<<"\nEnter your Guess again:"; 109 | cin>>n; 110 | if(r==n) 111 | { cout<<"\nYou Guess the correct Number\n"; 112 | delay(5000); 113 | clrscr(); 114 | cout<<"\n\nCongrulation you win the game\n\n"; 115 | cout<<"THANK YOU FOR PLAYING THE GAME\n\n"; 116 | cout<<"MADE BY- SHASHANK "; 117 | delay(8000); 118 | exit(0); 119 | } 120 | else if(r>n) 121 | { cout<<"\nIt is Low......!!\n"< 3 | #include 4 | #include 5 | #include 6 | class A 7 | { int i,j,i1,j1,a[4],b[10],e,e1,r,r1,n,p; 8 | char ch,c,v; 9 | public: 10 | A() 11 | { c='a'; 12 | i=0; 13 | i1=0; 14 | e=0; 15 | e1=0; 16 | n=0; 17 | p=0; 18 | } 19 | void B() 20 | { i=0; 21 | while(i<4) 22 | { e=0; 23 | r=rand()%4; 24 | for(j=0;j>ch; 38 | if(ch=='a') 39 | { if(a[0]==0) 40 | { cout<<"Correct input"; 41 | p++; 42 | } 43 | else 44 | { cout<<"Wrong input"; 45 | n++; 46 | } 47 | } 48 | else if(ch=='b') 49 | { if(a[1]==0) 50 | { cout<<"Correct input"; 51 | p++; 52 | } 53 | else 54 | { cout<<"Wrong input"; 55 | n++; 56 | } 57 | } 58 | else if(ch=='c') 59 | { if(a[2]==0) 60 | { cout<<"Correct input"; 61 | p++; 62 | } 63 | else 64 | { cout<<"Wrong input"; 65 | n++; 66 | } 67 | } 68 | else if(ch=='d') 69 | { if(a[3]==0) 70 | { cout<<"Correct input"; 71 | p++; 72 | } 73 | else 74 | { cout<<"Wrong input"; 75 | n++; 76 | } 77 | } 78 | else 79 | { cout<<"Wrong input"; 80 | n++; 81 | } 82 | getch(); 83 | c='a'; 84 | } 85 | void D() 86 | { while(i1<10) 87 | { e1=0; 88 | r1=rand()%10; 89 | for(j1=0;j1>v; 293 | switch(v) 294 | { case 's': D(); 295 | break; 296 | case 'q': cout<<"Quiz Quit"; 297 | getch(); 298 | exit(0); 299 | break; 300 | default : cout<<"Wrong input"; 301 | getch(); 302 | clrscr(); 303 | E(); 304 | break; 305 | } 306 | } 307 | void F() 308 | { cout<<"\t\t\tQUIZ\n\n"; 309 | cout<<"For start a Quiz Press s and For Qiut a Quiz Press q: s\n"; 310 | cout<<"Quiz Starts\n\n"; 311 | } 312 | }; 313 | void main() 314 | { time_t t; 315 | time(&t); 316 | srand((unsigned int) t); 317 | clrscr(); 318 | A obj; 319 | obj.E(); 320 | getch(); 321 | } 322 | -------------------------------------------------------------------------------- /Perodic Table.CPP: -------------------------------------------------------------------------------- 1 | //Perodic Table 2 | #include 3 | #include 4 | #include 5 | #include 6 | class A 7 | { int a; 8 | float am; 9 | char s1[20],s2[5]; 10 | public: 11 | void B() 12 | { cout<<"Enter Name of Element: "; 13 | cin>>s1; 14 | cout<<"Enter Symbol of Element: "; 15 | cin>>s2; 16 | cout<<"Enter Atomic Number: "; 17 | cin>>a; 18 | cout<<"Enter Atomic Mass: "; 19 | cin>>am; 20 | } 21 | void C() 22 | { cout<<"Name of Element: "<>ch; 39 | if(ch=='y'||ch=='Y') 40 | { cout<<"\nWhat you want to change\n"; 41 | cout<<"1.Name of Element\n2.Symbol of Element\n3.Atomic Mass\n\n"; 42 | cout<<"Enter your choice: "; 43 | cin>>b; 44 | switch(b) 45 | { case 1: cout<<"\nEnter New Name of Elment:"; 46 | cin>>s1; 47 | break; 48 | case 2: cout<<"\nEnter New Symbol of Element: "; 49 | cin>>s2; 50 | break; 51 | case 3: cout<<"\nEnter New Atomic Mass: "; 52 | cin>>am; 53 | break; 54 | default: cout<<"\nWrong Choice"; 55 | break; 56 | } 57 | } 58 | else 59 | { cout<<"\nRecord not Modify"; 60 | l=1; 61 | } 62 | return(l); 63 | } 64 | char F() 65 | { return(s2[0]); 66 | } 67 | char G() 68 | { return(s2[1]); 69 | } 70 | }; 71 | void main() 72 | { int x,r,rn,p,r1,rn1,k; 73 | char s3[5],s4[5]; 74 | long pos; 75 | clrscr(); 76 | A obj; 77 | while(x!=4) 78 | { clrscr(); 79 | cout<<"\t\t\t**********************\n"; 80 | cout<<"\t\t\t PERODIC TABLE\n"; 81 | cout<<"\t\t\t**********************\n\n\n"; 82 | cout<<"MENU\n\n"; 83 | cout<<"1.Press 1 for Add a New Element\n"; 84 | cout<<"2.Press 2 for Search a Element\n"; 85 | cout<<"3.Press 3 for Edit given Element\n"; 86 | cout<<"4.Press 4 for Exit\n\n"; 87 | cout<<"Enter your choice: "; 88 | cin>>x; 89 | switch(x) 90 | { case 1: clrscr(); 91 | cout<<"Adding a New Element\n\n"; 92 | ofstream outfile1; 93 | outfile1.open("perodictable.dat",ios::app|ios::binary); 94 | obj.B(); 95 | outfile1.write((char*)&obj,sizeof(obj)); 96 | outfile1.close(); 97 | cout<<"\n\nDetails that you have added\n\n"; 98 | obj.C(); 99 | getch(); 100 | break; 101 | case 2: int f=0; 102 | clrscr(); 103 | cout<<"Searching the Details of Element\n\n"; 104 | ifstream infile1; 105 | infile1.open("perodictable.dat",ios::in|ios::binary); 106 | cout<<"What you want to Search Element: \n"; 107 | cout<<"1.By Symbol\n2.By Atomic Number\n\n"; 108 | cout<<"Enter your Choice: "; 109 | cin>>p; 110 | if(p==1) 111 | { cout<<"Enter Symbol: "; 112 | cin>>s3; 113 | while(infile1.read((char*)&obj,sizeof(obj))) 114 | { s4[0]=obj.F(); 115 | s4[1]=obj.G(); 116 | s4[2]='\0'; 117 | if(strcmp(s3,s4)==0) 118 | { cout<<"\nRecord found !!!\n\n"; 119 | obj.C(); 120 | f=1; 121 | getch(); 122 | break; 123 | } 124 | } 125 | infile1.close(); 126 | if(f==0) 127 | cout<<"\nSorry ! Record Not Found\n"; 128 | getch(); 129 | } 130 | else if(p==2) 131 | { cout<<"Enter Atomic Number: "; 132 | cin>>r; 133 | while(infile1.read((char*)&obj,sizeof(obj))) 134 | { rn=obj.D(); 135 | if(r==rn) 136 | { cout<<"\nRecord found !!!\n\n"; 137 | obj.C(); 138 | f=1; 139 | getch(); 140 | break; 141 | } 142 | } 143 | infile1.close(); 144 | if(f==0) 145 | cout<<"\nSorry ! Record Not Found\n"; 146 | getch(); 147 | } 148 | else 149 | { cout<<"\nWrong Choice"; 150 | getch(); 151 | } 152 | break; 153 | case 3: int y=0; 154 | clrscr(); 155 | cout<<"Editing the exiting Element\n\n"; 156 | fstream inout; 157 | inout.open("perodictable.dat",ios::out|ios::in|ios::binary); 158 | cout<<"\nEnter Atomic Number: "; 159 | cin>>r1; 160 | while(inout) 161 | { pos=inout.tellg(); 162 | inout.read((char*)&obj,sizeof(obj)); 163 | rn1=obj.D(); 164 | if(rn1==r1) 165 | { k=obj.E(); 166 | y=1; 167 | inout.seekg(pos); 168 | inout.write((char*)&obj,sizeof(obj)); 169 | getch(); 170 | if(k==0) 171 | { cout<<"\nRecord Modified Successfully"; 172 | getch(); 173 | clrscr(); 174 | cout<<"Modify Record is shown below-\n\n"; 175 | obj.C(); 176 | getch(); 177 | } 178 | break; 179 | } 180 | } 181 | inout.close(); 182 | if(y==0) 183 | cout<<"\nSorry ! Record not Found"; 184 | getch(); 185 | break; 186 | case 4: cout<<"EXIT"; 187 | break; 188 | default: cout<<"Wrong choice"; 189 | getch(); 190 | break; 191 | } 192 | } 193 | getch(); 194 | } -------------------------------------------------------------------------------- /QUIZ.C: -------------------------------------------------------------------------------- 1 | //Quiz 2 | #include 3 | #include 4 | #include 5 | #include 6 | void main() 7 | { char ch,d; 8 | int b[3000],a,i,c=-1,e,k=0,p=0,n=0; 9 | time_t t; 10 | clrscr(); 11 | time(&t); 12 | srand((unsigned int) t); 13 | printf("\t\t\t\tQUIZ\n"); 14 | printf("For start a Quiz Press s and For Qiut a Quiz Press q: "); 15 | scanf("%s",&ch); 16 | switch(ch) 17 | { case 's': for(i=0;;i++) 18 | { e=0; 19 | a=rand()%10; 20 | b[i]=a; 21 | c++; 22 | for(i=0;i 3 | #include 4 | #include 5 | #include 6 | class A 7 | { int r; 8 | float per,t,e,p,c,cp,m; 9 | char s1[2000],s2[2000],s3[2000],s4[2000]; 10 | public: 11 | void B() 12 | { cout<<"Enter Name of Student: "; 13 | gets(s1); 14 | cout<<"Enter Father's name: "; 15 | gets(s2); 16 | cout<<"Enter Mother's Name: "; 17 | gets(s3); 18 | cout<<"Enter Class: "; 19 | cin>>s4; 20 | cout<<"Enter Roll Number: "; 21 | cin>>r; 22 | cout<<"Enter 5 Subject Marks(out of 100):\n"; 23 | cout<<"English: "; 24 | cin>>e; 25 | cout<<"Physics: "; 26 | cin>>p; 27 | cout<<"Chemisrty: "; 28 | cin>>c; 29 | cout<<"Maths: "; 30 | cin>>m; 31 | cout<<"Computer: "; 32 | cin>>cp; 33 | } 34 | void C() 35 | { cout<<"Name of Student: "<>ch; 66 | if(ch=='y'||ch=='Y') 67 | { cout<<"\nWhat you want to change\n"; 68 | cout<<"1.Name of Student\n2.Father's Name\n3.Mother's Name\n4.Subjects Marks\n\n"; 69 | cout<<"Enter your choice: "; 70 | cin>>b; 71 | switch(b) 72 | { case 1: cout<<"\nEnter New Name of Student:"; 73 | gets(s1); 74 | break; 75 | case 2: cout<<"\nEnter Father's Name: "; 76 | gets(s2); 77 | break; 78 | case 3: cout<<"\nEnter Mother's Name: "; 79 | gets(s3); 80 | break; 81 | case 4: cout<<"Enter New Subjects Marks:\n"; 82 | cout<<"English: "; 83 | cin>>e; 84 | cout<<"Physics: "; 85 | cin>>p; 86 | cout<<"Chemisrty: "; 87 | cin>>c; 88 | cout<<"Maths: "; 89 | cin>>m; 90 | cout<<"Computer: "; 91 | cin>>cp; 92 | break; 93 | default: cout<<"\nWrong Choice"; 94 | break; 95 | } 96 | } 97 | else 98 | { cout<<"\nRecord not Modify"; 99 | l=1; 100 | } 101 | return(l); 102 | } 103 | void F() 104 | { cout<<"Name of Student: "<=85) 158 | cout<<"Result: Excellent"; 159 | else if(per>=75&&per<85) 160 | cout<<"Result: Very Good"; 161 | else if(per>=65&&per<75) 162 | cout<<"Result: Good"; 163 | else 164 | cout<<"Result: fair"; 165 | } 166 | }; 167 | void main() 168 | { int x,r,rn,r1,rn1,r2,rn2,k; 169 | long pos; 170 | clrscr(); 171 | A obj; 172 | while(x!=5) 173 | { clrscr(); 174 | cout<<"\t\t\t*************************\n"; 175 | cout<<"\t\t\tSTUDENT MANAGEMENT SYSTEM\n"; 176 | cout<<"\t\t\t**************************\n\n\n"; 177 | cout<<"MENU\n\n"; 178 | cout<<"1.Press 1 for Add a New Record of Studemt\n"; 179 | cout<<"2.Press 2 for Search a Record of Student\n"; 180 | cout<<"3.Press 3 for Edit Record of Student\n"; 181 | cout<<"4.Press 4 for Delete the Record of Student\n"; 182 | cout<<"5.Press 5 for Exit\n\n"; 183 | cout<<"Enter your choice: "; 184 | cin>>x; 185 | switch(x) 186 | { case 1: clrscr(); 187 | cout<<"Adding a New Record\n\n"; 188 | ofstream outfile1; 189 | outfile1.open("sms.dat",ios::app|ios::binary); 190 | obj.B(); 191 | outfile1.write((char*)&obj,sizeof(obj)); 192 | outfile1.close(); 193 | cout<<"\n\nDetails that you have added\n\n"; 194 | obj.C(); 195 | getch(); 196 | break; 197 | case 2: int f=0; 198 | clrscr(); 199 | cout<<"Searching the Details of Student\n\n"; 200 | ifstream infile1; 201 | infile1.open("sms.dat",ios::in|ios::binary); 202 | cout<<"Enter Student Roll Number: "; 203 | cin>>r2; 204 | while(infile1.read((char*)&obj,sizeof(obj))) 205 | { rn2=obj.D(); 206 | if(rn2==r2) 207 | { cout<<"\nRecord found !!!\n\n"; 208 | obj.F(); 209 | f=1; 210 | getch(); 211 | break; 212 | } 213 | } 214 | infile1.close(); 215 | if(f==0) 216 | cout<<"\nSorry ! Record Not Found\n"; 217 | getch(); 218 | break; 219 | case 3: int y=0; 220 | clrscr(); 221 | cout<<"Editing the Student Record\n\n"; 222 | fstream inout; 223 | inout.open("sms.dat",ios::out|ios::in|ios::binary); 224 | cout<<"\nEnter Roll No. of Student: "; 225 | cin>>r1; 226 | while(inout) 227 | { pos=inout.tellg(); 228 | inout.read((char*)&obj,sizeof(obj)); 229 | rn1=obj.D(); 230 | if(rn1==r1) 231 | { k=obj.E(); 232 | y=1; 233 | inout.seekg(pos); 234 | inout.write((char*)&obj,sizeof(obj)); 235 | getch(); 236 | if(k==0) 237 | { cout<<"\nRecord Modified Successfully"; 238 | getch(); 239 | clrscr(); 240 | cout<<"Modify Record is shown below-\n\n"; 241 | obj.F(); 242 | getch(); 243 | } 244 | break; 245 | } 246 | } 247 | inout.close(); 248 | if(y==0) 249 | cout<<"\nSorry ! Record not Found"; 250 | getch(); 251 | break; 252 | case 4: int g=0; 253 | char d; 254 | clrscr(); 255 | cout<<"Deleting the Student Record\n\n"; 256 | ofstream outfile3; 257 | outfile3.open("temp.dat",ios::out|ios::binary); 258 | ifstream infile4; 259 | infile4.open("sms.dat",ios::out|ios::binary); 260 | cout<<"Enter Student Roll no. you want to delete from record: "; 261 | cin>>r2; 262 | while(infile4.read((char*)&obj,sizeof(obj))) 263 | { rn2=obj.D(); 264 | if(rn2==r2) 265 | { g=1; 266 | cout<<"\nThe record you want to delete is:\n\n"; 267 | obj.C(); 268 | cout<<"\nAre you sure to delete the record(Y/N):"; 269 | cin>>d; 270 | if(d=='n'||d=='N') 271 | { outfile3.write((char*)&obj,sizeof(obj)); 272 | cout<<"\nThe Record is not deleted"; 273 | } 274 | else 275 | cout<<"\nStudent Record successfully Deleted"; 276 | } 277 | else 278 | outfile3.write((char*)&obj,sizeof(obj)); 279 | } 280 | if(g==0) 281 | cout<<"\nSorry ! The Record you want to delete is not Found"; 282 | outfile3.close(); 283 | infile4.close(); 284 | remove("sms.dat"); 285 | rename("temp.dat","sms.dat"); 286 | getch(); 287 | break; 288 | case 5: cout<<"EXIT"; 289 | break; 290 | default: cout<<"Wrong choice"; 291 | getch(); 292 | break; 293 | } 294 | } 295 | getch(); 296 | } -------------------------------------------------------------------------------- /Sudoku.CPP: -------------------------------------------------------------------------------- 1 | //Sudoku 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | class A 8 | { int i,j,k,l,a[9][9],b[9][9],m[10],r1,r2,r3,t,e,e1,r,c,n,x,p,q; 9 | public: 10 | A() 11 | { k=0; 12 | while(k<9) 13 | { e=0; 14 | r3=rand()%10; 15 | for(l=0;l>p; 104 | if(p==1) 105 | q=11; 106 | else if(p==2) 107 | q=21; 108 | else if(p==3) 109 | q=31; 110 | else if(p==4) 111 | q=40; 112 | else 113 | { cout<<"Wrong Input"; 114 | getch(); 115 | F(); 116 | } 117 | for(i=0;i>x; 199 | switch(x) 200 | { case 1: w=1; 201 | F(); 202 | clrscr(); 203 | H(); 204 | break; 205 | case 2: w=1; 206 | clrscr(); 207 | cout<<"\t\tINSTRUCTIOMS\n\n"; 208 | cout<<"1.The aim of the puzzle is to enter a digit from 1 to 9.\n"; 209 | cout<<"2.In each cell of a 9X9 grid made up of 3X3 subgrids.\n"; 210 | cout<<"3.In each row,column,and subgrid must contain only one instance of each digit.\n"; 211 | cout<<"4.For seeing the solution of given Sudoku puzzle press number '10' in row and press Enter button.\n"; 212 | cout<<"\nPress enter button to start Sudoku puzzle"; 213 | getch(); 214 | F(); 215 | clrscr(); 216 | H(); 217 | break; 218 | case 3: exit(0); 219 | default: cout<<"Wrong Input"< 3 | #include 4 | #include 5 | #include 6 | void main() 7 | { clrscr(); 8 | textcolor(WHITE); 9 | textbackground(BLUE); 10 | char s[3][3]; 11 | int i,j,r,c,v=0,p,q,e,z,n,m,f,w,b; 12 | for(i=0;i<3;i++) 13 | { for(j=0;j<3;j++) 14 | s[i][j]=' '; 15 | } 16 | while(v!=10) 17 | { z=0; 18 | w=0; 19 | clrscr(); 20 | printf("\t\t TIC TAC TOE GAME\n"); 21 | printf("\t\t ~~~~~~~~~~~~~~~~~\n"); 22 | printf("Game start\n\n"); 23 | for(i=0;i<3;i++) 24 | { for(j=0;j<3;j++) 25 | { printf("_ %c |",s[i][j]); 26 | if(s[i][j]==' ') 27 | w=1; 28 | } 29 | printf("\n"); 30 | } 31 | if(w==0) 32 | { printf("\nTie"); 33 | getch(); 34 | exit(0); 35 | } 36 | printf("\nUser turn\n"); 37 | printf("\nEnter row="); 38 | scanf("%d",&r); 39 | printf("Enter column="); 40 | scanf("%d",&c); 41 | if(r>0&&r<4&&c>0&&c<4) 42 | { if(s[r-1][c-1]==' ') 43 | { s[r-1][c-1]='X'; 44 | clrscr(); 45 | printf("\t\t TIC TAC TOE GAME\n"); 46 | printf("\t\t ~~~~~~~~~~~~~~~~~\n"); 47 | printf("Game start\n\n"); 48 | for(i=0;i<3;i++) 49 | { for(j=0;j<3;j++) 50 | printf("_ %c |",s[i][j]); 51 | printf("\n"); 52 | } 53 | delay(900); 54 | if(v==0) 55 | { if(r==2&&c==2) 56 | { printf("\n\nComputer turn\n\n"); 57 | for(b=20;b<=100;b+=20) 58 | { printf("Loading...%d%\r",b); 59 | sleep(1); 60 | } 61 | printf("\ndone"); 62 | delay(900); 63 | s[0][2]='O'; 64 | v++; 65 | } 66 | else 67 | { printf("\n\nComputer turn\n\n"); 68 | for(b=20;b<=100;b+=20) 69 | { printf("Loading...%d%\r",b); 70 | sleep(1); 71 | } 72 | printf("\ndone"); 73 | delay(900); 74 | s[1][1]='O'; 75 | v++; 76 | } 77 | } 78 | if(v>1) 79 | { for(i=0;i<3;i++) 80 | { for(j=0;j<3;j++) 81 | { if(s[i][j]==' ') 82 | { f=0; 83 | s[i][j]='O'; 84 | for(p=0;p<3;p++) 85 | { if(s[p][0]=='O'&&s[p][1]=='O'&&s[p][2]=='O') 86 | { printf("\n\nComputer turn\n\n"); 87 | for(b=20;b<=100;b+=20) 88 | { printf("Loading...%d%\r",b); 89 | sleep(1); 90 | } 91 | printf("\ndone"); 92 | delay(900); 93 | s[i][j]='O'; 94 | f=1; 95 | clrscr(); 96 | printf("\t\t TIC TAC TOE GAME\n"); 97 | printf("\t\t ~~~~~~~~~~~~~~~~~\n"); 98 | printf("Game start\n\n"); 99 | for(i=0;i<3;i++) 100 | { for(j=0;j<3;j++) 101 | printf("_ %c |",s[i][j]); 102 | printf("\n"); 103 | } 104 | printf("\nComputer Wins"); 105 | getch(); 106 | exit(0); 107 | } 108 | } 109 | for(q=0;q<3;q++) 110 | { if(s[0][q]=='O'&&s[1][q]=='O'&&s[2][q]=='O') 111 | { printf("\n\nComputer turn\n\n"); 112 | for(b=20;b<=100;b+=20) 113 | { printf("Loading...%d%\r",b); 114 | sleep(1); 115 | } 116 | printf("\ndone"); 117 | delay(900); 118 | s[i][j]='O'; 119 | f=1; 120 | clrscr(); 121 | printf("\t\t TIC TAC TOE GAME\n"); 122 | printf("\t\t ~~~~~~~~~~~~~~~~~\n"); 123 | printf("Game start\n\n"); 124 | for(i=0;i<3;i++) 125 | { for(j=0;j<3;j++) 126 | printf("_ %c |",s[i][j]); 127 | printf("\n"); 128 | } 129 | printf("\nComputer Wins"); 130 | getch(); 131 | exit(0); 132 | } 133 | } 134 | if(s[0][0]=='O'&&s[1][1]=='O'&&s[2][2]=='O') 135 | { printf("\n\nComputer turn\n\n"); 136 | for(b=20;b<=100;b+=20) 137 | { printf("Loading...%d%\r",b); 138 | sleep(1); 139 | } 140 | printf("\ndone"); 141 | delay(900); 142 | s[i][j]='O'; 143 | f=1; 144 | clrscr(); 145 | printf("\t\t TIC TAC TOE GAME\n"); 146 | printf("\t\t ~~~~~~~~~~~~~~~~~\n"); 147 | printf("Game start\n\n"); 148 | for(i=0;i<3;i++) 149 | { for(j=0;j<3;j++) 150 | printf("_ %c |",s[i][j]); 151 | printf("\n"); 152 | } 153 | printf("\nComputer Wins"); 154 | getch(); 155 | exit(0); 156 | } 157 | if(s[0][2]=='O'&&s[1][1]=='O'&&s[2][0]=='O') 158 | { printf("\n\nComputer turn\n\n"); 159 | for(b=20;b<=100;b+=20) 160 | { printf("Loading...%d%\r",b); 161 | sleep(1); 162 | } 163 | printf("\ndone"); 164 | delay(900); 165 | s[i][j]='O'; 166 | f=1; 167 | clrscr(); 168 | printf("\t\t TIC TAC TOE GAME\n"); 169 | printf("\t\t ~~~~~~~~~~~~~~~~~\n"); 170 | printf("Game start\n\n"); 171 | for(i=0;i<3;i++) 172 | { for(j=0;j<3;j++) 173 | printf("_ %c |",s[i][j]); 174 | printf("\n"); 175 | } 176 | printf("\nComputer Wins"); 177 | getch(); 178 | exit(0); 179 | } 180 | if(f!=1) 181 | s[i][j]=' '; 182 | } 183 | } 184 | } 185 | } 186 | if(v>1) 187 | { for(i=0;i<3;i++) 188 | { for(j=0;j<3;j++) 189 | { if(s[i][j]==' ') 190 | { e=0; 191 | s[i][j]='X'; 192 | for(p=0;p<3;p++) 193 | { if(s[p][0]=='X'&&s[p][1]=='X'&&s[p][2]=='X') 194 | { printf("\n\nComputer turn\n\n"); 195 | for(b=20;b<=100;b+=20) 196 | { printf("Loading...%d%\r",b); 197 | sleep(1); 198 | } 199 | printf("\ndone"); 200 | delay(900); 201 | s[i][j]='O'; 202 | e=1; 203 | z=1; 204 | break; 205 | } 206 | } 207 | for(q=0;q<3;q++) 208 | { if(s[0][q]=='X'&&s[1][q]=='X'&&s[2][q]=='X') 209 | { printf("\n\nComputer turn\n\n"); 210 | for(b=20;b<=100;b+=20) 211 | { printf("Loading...%d%\r",b); 212 | sleep(1); 213 | } 214 | printf("\ndone"); 215 | delay(900); 216 | s[i][j]='O'; 217 | z=1; 218 | e=1; 219 | break; 220 | } 221 | } 222 | if(s[0][0]=='X'&&s[1][1]=='X'&&s[2][2]=='X') 223 | { printf("\n\nComputer turn\n\n"); 224 | for(b=20;b<=100;b+=20) 225 | { printf("Loading...%d%\r",b); 226 | sleep(1); 227 | } 228 | printf("\ndone"); 229 | delay(900); 230 | s[i][j]='O'; 231 | z=1; 232 | e=1; 233 | break; 234 | } 235 | if(s[0][2]=='X'&&s[1][1]=='X'&&s[2][0]=='X') 236 | { clrscr(); 237 | printf("\n\nComputer turn\n\n"); 238 | for(b=20;b<=100;b+=20) 239 | { printf("Loading...%d%\r",b); 240 | sleep(1); 241 | } 242 | printf("\ndone"); 243 | delay(900); 244 | s[i][j]='O'; 245 | e=1; 246 | z=1; 247 | break; 248 | } 249 | if(e!=1) 250 | s[i][j]=' '; 251 | } 252 | } 253 | } 254 | if(z==0) 255 | { for(n=0;n<3;n++) 256 | { for(m=0;m<3;m++) 257 | { if(s[n][m]==' ') 258 | { printf("\n\nComputer turn\n\n"); 259 | for(b=20;b<=100;b+=20) 260 | { printf("Loading...%d%\r",b); 261 | sleep(1); 262 | } 263 | printf("\ndone"); 264 | delay(900); 265 | if(s[1][1]=='O'&&s[1][2]=='X'&&s[2][0]=='X'&&s[0][0]==' '&&s[0][1]==' '&&s[0][2]==' ') 266 | s[0][2]='O'; 267 | else if(s[1][1]=='O'&&s[1][2]=='X'&&s[2][1]=='X'&&s[0][0]==' '&&s[0][1]==' '&&s[0][2]==' ') 268 | s[0][2]='O'; 269 | else if(s[1][1]=='O'&&s[0][2]=='X'&&s[2][0]=='X'&&s[0][0]==' '&&s[0][1]==' '&&s[1][0]==' ') 270 | s[0][1]='O'; 271 | else if(s[1][1]=='O'&&s[0][2]=='X'&&s[2][1]=='X'&&s[0][0]==' '&&s[0][1]==' '&&s[1][0]==' ') 272 | s[1][0]='O'; 273 | else if(s[1][1]=='O'&&s[0][0]=='X'&&s[2][1]=='X'&&s[0][1]==' '&&s[0][2]==' '&&s[1][2]==' ') 274 | s[2][0]='O'; 275 | else if(s[1][1]=='O'&&s[0][0]=='X'&&s[1][2]=='X'&&s[0][1]==' '&&s[0][2]==' '&&s[1][0]==' ') 276 | s[0][2]='O'; 277 | else 278 | s[n][m]='O'; 279 | n=3; 280 | m=3; 281 | } 282 | } 283 | } 284 | } 285 | } 286 | } 287 | else 288 | { printf("Invalid choice\n"); 289 | getch(); 290 | } 291 | v++; 292 | } 293 | else 294 | { printf("Invalid choice\n"); 295 | getch(); 296 | } 297 | } 298 | getch(); 299 | } 300 | --------------------------------------------------------------------------------