Advertisement
zaman360live

4031 CSE Assignment by Amit Sir

Aug 11th, 2021
1,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 16.18 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<ctype.h>
  4. #include<stdlib.h>
  5. #include<string.h>
  6.  
  7. void about();
  8. void help();
  9. int main()
  10. {
  11.  
  12.     typedef struct aisystem
  13.     {
  14.         int countr,r,r1,count,i,n;
  15.         float score;
  16.         char choice;
  17.         char playername[20];
  18.     }z_ai; //z means Zaman AI
  19.  
  20.  
  21.         z_ai zaman;
  22.         mainhome:
  23.         system("cls");
  24.    
  25.         printf("\n\t\t   WELCOME to ZaMaN's c-AI!!!!!!!!!!    ");
  26.         printf("\n\t\t________________________________________");
  27.         printf("\n\t\t________________________________________");
  28.         printf("\n\t\t > Press S to Enter to The Program      ");
  29.         printf("\n\t\t > Press H for Help                     ");
  30.         printf("\n\t\t > press A for About Developer          ");
  31.         printf("\n\t\t > press Q to quit                      ");
  32.         printf("\n\t\t________________________________________\n\n");
  33.  
  34.  
  35.         zaman.choice=toupper(getch());
  36.         if (zaman.choice=='A')
  37.         {
  38.         about();
  39.         goto mainhome;
  40.         }
  41.         else if (zaman.choice=='H')
  42.         {
  43.         help();getch();
  44.         goto mainhome;
  45.         }
  46.         else if (zaman.choice=='Q')
  47.         exit(1);
  48.         else if(zaman.choice=='S')
  49.             {
  50.                 system("cls");
  51.  
  52.                 printf("\n\n\n\n\n\n\n\n\n\n\t\t\tWhat is Your Name:");
  53.                 gets(zaman.playername);
  54.  
  55.                 system("cls");
  56.                 printf("\n ------------------  Welcome %s to ZaMaN's c-AI--------------------------",zaman.playername);
  57.                 printf("\n\n Here are some tips for:          ");
  58.                 printf("\n -------------------------------------------------------------------------");
  59.                 printf("\n >>Must  Ans two questions to check your Abilities: ");
  60.                 printf("\n >>Then Ans 20 Questions: ");
  61.                 printf("\n\n\n Press Y  to start the game!\n");
  62.                 printf("\n Press any other key to return to the main menu!");  
  63.             }
  64.             if (toupper(getch())=='Y')
  65.             {
  66.             goto home;
  67.             }
  68.             else
  69.             {
  70.                 goto mainhome;
  71.                 system("cls");
  72.             }
  73.             home:
  74.                 system("cls");
  75.                 zaman.count=0;
  76.                 for(zaman.i=1;zaman.i<=2;zaman.i++)
  77.                 {
  78.                     system("cls");
  79.                     zaman.r1=zaman.i;
  80.                     switch(zaman.r1)
  81.                     {
  82.                         case 1:
  83.                         printf("\n\nWho is OUR CSE 122 class Teacher?");
  84.                         printf("\n\nA.Amit Sir\t\tB. Zaman Sir\n\nC.Kobir Sirt\tD.Raju Sir");
  85.                         if (toupper(getch())=='A')
  86.                         {
  87.                             printf("\n\nCorrect!!!");zaman.count++;
  88.                             getch();
  89.                             break;
  90.                         }
  91.                         else
  92.                         {
  93.                             printf("\n\nWrong!!! The correct answer Amit Sir");
  94.                             getch();
  95.                             break;
  96.                         }
  97.  
  98.                         case 2:
  99.                         printf("\n\n\nWhat is the full meaning of CSE?");
  100.                         printf("\n\nA.Computer Science and Engineering\t\tB.WWW\n\nC.Daffodil\t\tD.Computer Science");
  101.                         if (toupper(getch())=='A')
  102.                         {
  103.                             printf("\n\nCorrect!!!");zaman.count++;
  104.                             getch();
  105.                             break;
  106.                         }
  107.                         else
  108.                         {
  109.                             printf("\n\nWrong!!! The correct answer is A.Computer Science and Engineering");
  110.                             getch();
  111.                             break;
  112.                         }
  113.                     }
  114.                 }
  115.  
  116.         if(zaman.count>=2)
  117.         {
  118.             goto test;
  119.         }
  120.         else
  121.         {
  122.             system("cls");
  123.             printf("\n\nHey Bro! See you not for mind. Relux and Get OUT");
  124.             getch();
  125.             goto mainhome;
  126.         }
  127.  
  128.         test:
  129.         system("cls");
  130.         printf("\n\n\t*** CONGRATULATION %s Bro! Lets Play ***",zaman.playername);
  131.         printf("\n\n\n\n\t!Press P to Start the Game!");
  132.         if(toupper(getch())=='P')
  133.         {
  134.             goto game;
  135.         }
  136.  
  137.  
  138.         game:
  139.         zaman.countr=0;
  140.         for(zaman.i=1;zaman.i<=20;zaman.i++)
  141.         {
  142.             system("cls");
  143.             zaman.r=zaman.i;
  144.    
  145.             switch(zaman.r)
  146.             {
  147.                 case 1:
  148.                 printf("\n\n    --------- is the father of computer.?");
  149.                 printf("\n\nA.Herman Hollerith\t\tB. Ada Byron\n\nC.Blaise Pascal\t\tD.Charles Babbage");
  150.                 if (toupper(getch())=='D')
  151.                 {
  152.                     printf("\n\nCorrect!!!");zaman.countr++;
  153.                     getch();
  154.                     break;
  155.                 }
  156.                 else
  157.                 {
  158.                     printf("\n\nWrong!!! The correct answer is D.Charles Babbage");
  159.                     getch();
  160.                     goto scoreboard;
  161.                     break;
  162.                 }
  163.  
  164.                 case 2:
  165.                 printf("\n\n    A desktop computer is also known as__");
  166.                 printf("\n\nA.PC\t\tB.Laptop\n\nC. Mainframe\t\tD.Palmtop");
  167.                 if (toupper(getch())=='A')
  168.                 {
  169.                     printf("\n\nCorrect!!!");zaman.countr++;
  170.                     getch();
  171.                     break;
  172.                 }
  173.                 else
  174.                 {
  175.                     printf("\n\nWrong!!! The correct answer is A.PC");
  176.                     getch();
  177.                     goto scoreboard;
  178.                     break;
  179.                 }
  180.                 case 3:
  181.                 printf("\n\n    CPU is the --------- of computer.");
  182.                 printf("\n\nA.Brain\t\tB.Ear\n\nC.Eye\t\tD.All above these");
  183.                 if (toupper(getch())=='A')
  184.                 {
  185.                     printf("\n\nCorrect!!!");zaman.countr++;
  186.                     getch();
  187.                     break;
  188.                     getch();
  189.                 }
  190.                 else
  191.                 {
  192.                     printf("\n\nWrong!!! The correct answer is A.Brain");
  193.                     getch();
  194.                     goto scoreboard;
  195.                     break;
  196.                 }
  197.  
  198.                 case 4:
  199.                 printf("\n\n    Which of the following is not Computer Hardware?");
  200.                 printf("\n\nA.Mouse\t\tB.Monitor\n\nC.Printer\t\tD.Antivirus");
  201.                 if (toupper(getch())=='D')
  202.                 {
  203.                     printf("\n\nCorrect!!!");zaman.countr++;
  204.                     getch();
  205.                     break;
  206.                     getch();
  207.                 }
  208.                 else
  209.                 {
  210.                     printf("\n\nWrong!!! The correct answer is D. Antivirus");
  211.                     getch();
  212.                     goto scoreboard;
  213.                     break;
  214.                 }
  215.    
  216.                 case 5:
  217.                 printf("\n\n Which of the following is an example of web browser?");
  218.                 printf("\n\nA.C++\t\tB.Tally\n\nC.Wide area network\t\tD.None of these");
  219.                 if (toupper(getch())=='C')
  220.                 {
  221.                     printf("\n\nCorrect!!!");zaman.countr++;
  222.                     getch();
  223.                     break;
  224.                     getch();
  225.                 }
  226.                 else
  227.                 {
  228.                     printf("\n\nWrong!!! The correct answer is C. Wide area network");
  229.                     getch();
  230.                     goto scoreboard;
  231.                     break;
  232.                 }
  233.  
  234.                 case 6:
  235.                 printf("\n\n    What of these full form of e-mail?");
  236.                 printf("\n\nA.Electric mail\t\tB.Electromagnetic mail\n\nC.Electronic mail\t\tD.None of these");
  237.                 if (toupper(getch())=='C')
  238.                 {
  239.                     printf("\n\nCorrect!!!");zaman.countr++;
  240.                     getch();
  241.                     break;
  242.                     getch();
  243.                 }
  244.                 else
  245.                 {
  246.                     printf("\n\nWrong!!! The correct answer is C. Electronic mail");
  247.                     getch();
  248.                     goto scoreboard;
  249.                     break;
  250.                 }
  251.                 case 7:
  252.                 printf("\n\n    Which one of the following is not a computer language?");
  253.                 printf("\n\nA.BASIC\t\tB. C\n\nC. Fast\t\tD.FORTRAN");
  254.                 if (toupper(getch())=='C')
  255.                 {
  256.                     printf("\n\nCorrect!!!");zaman.countr++;
  257.                     getch();
  258.                     break;
  259.                     getch();
  260.                 }
  261.                 else
  262.                 {
  263.                     printf("\n\nWrong!!! The correct answer is C. Fast");              
  264.                     getch();               
  265.                     goto scoreboard;
  266.                     break;
  267.                 }
  268.  
  269.  
  270.                 case 8:
  271.                 printf("\n\n    A -------- is a computer connected to two networks.");
  272.                 printf("\n\nA.Server\t\tB.Gateway\n\nC.Bridge way\t\tD.Link");
  273.                 if (toupper(getch())=='A')
  274.                 {
  275.                     printf("\n\nCorrect!!!");zaman.countr++;
  276.                     getch();
  277.                     break;
  278.                     getch();
  279.                 }
  280.                 else
  281.                 {
  282.                     printf("\n\nWrong!!! The correct answer is A.Server");
  283.                     getch();
  284.                     goto scoreboard;
  285.                     break;
  286.                 }
  287.  
  288.                 case 9:
  289.                 printf("\n\n Who was the inventor and founder of www?");
  290.                 printf("\n\nA.Russel\t\tB.Bill gates\n\nC.Lee N.Fiyong\t\tD.Tim Berners lee");
  291.                 if (toupper(getch())=='D')
  292.                 {
  293.                     printf("\n\nCorrect!!!");zaman.countr++;
  294.                     getch();
  295.                     break;
  296.                     getch();
  297.                 }
  298.                 else
  299.                 {
  300.                     printf("\n\nWrong!!! The correct answer is D.Tim Berners lee");
  301.                     getch();
  302.                     goto scoreboard;
  303.                     break;
  304.                 }
  305.  
  306.                 case 10:
  307.                 printf("\n\n How many kilobytes make a megabyte?");
  308.                 printf("\n\nA.256\t\tB. 512\n\nC. 1024\t\tD.2048");
  309.                 if (toupper(getch())=='C')
  310.                 {
  311.                     printf("\n\nCorrect!!!");zaman.countr++;
  312.                     getch();
  313.                     break;
  314.                     getch();
  315.                 }
  316.                 else
  317.                 {
  318.                     printf("\n\nWrong!!! The correct answer is C. 1024");
  319.                     getch();
  320.                     goto scoreboard;
  321.                     break;
  322.                 }
  323.  
  324.                 case 11:
  325.                 printf("\n\n    IBM stands for.");
  326.                 printf("\n\nA.Indian Business Machine\t\tB.Internal Business Machine\n\nC.International Business Machine\t\tD.Integrated Business Machine");
  327.                 if (toupper(getch())=='B')
  328.                 {
  329.                     printf("\n\nCorrect!!!");zaman.countr++;
  330.                     getch();
  331.                     break;
  332.                     getch();
  333.                 }
  334.                 else
  335.                 {
  336.                     printf("\n\nWrong!!! The correct answer is B. Internal Business Machine");
  337.                     getch();
  338.                     goto scoreboard;
  339.                     break;
  340.                 }
  341.  
  342.                 case 12:
  343.                 printf("\n\n ___ is used in fourth generation computer.");
  344.                 printf("\n\nA.Transistors\t\tB.Vacuum tubes\n\nC.Microprocessor\t\tD.Integrated circuit");
  345.                 if (toupper(getch())=='C')
  346.                 {
  347.                     printf("\n\nCorrect!!!");zaman.countr++;
  348.                     getch();
  349.                     break;
  350.                     getch();
  351.                 }
  352.                 else
  353.                 {
  354.                     printf("\n\nWrong!!! The correct answer is C. Microprocessor");
  355.                     getch();
  356.                     goto scoreboard;
  357.                     break;
  358.                 }
  359.  
  360.  
  361.                 case 13:
  362.                 printf("\n\n A _____ is a software application for retrieving, presenting and traversing information.");
  363.                 printf("\n\nA.HTTP\t\tB.E-mail\n\nC.Web browser\t\tD.Search engine");
  364.                 if (toupper(getch())=='C')
  365.                 {
  366.                     printf("\n\nCorrect!!!");zaman.countr++;
  367.                     getch();
  368.                     break;
  369.                     getch();
  370.                 }
  371.                 else
  372.                 {
  373.                     printf("\n\nWrong!!! The correct answer is C. Web browser");
  374.                     getch();
  375.                     goto scoreboard;
  376.                     break;
  377.                 }
  378.  
  379.  
  380.                 case 14:
  381.                 printf("\n\n    An online backing storage system capable of storing larger quantities of data is");
  382.                 printf("\n\nA.Temporary storage\t\tB.Secondary storage\n\nC.Mass storage\t\tD.Memory");
  383.                 if (toupper(getch())=='C')
  384.                 {
  385.                     printf("\n\nCorrect!!!");zaman.countr++;
  386.                     getch();
  387.                     break;
  388.                     getch();
  389.                 }
  390.                 else
  391.                 {
  392.                     printf("\n\nWrong!!! The correct answer is C. Mass storage");
  393.                     getch();
  394.                     goto scoreboard;
  395.                     break;
  396.                 }
  397.  
  398.  
  399.                 case 15:
  400.                 printf("\n\n    POST stands for");
  401.                 printf("\n\nA.Power Off System Test\t\tB.Program On System Test\n\nC.Power On System Test\t\tD.Power On Self Test");
  402.                 if (toupper(getch())=='D')
  403.                 {
  404.                     printf("\n\nCorrect!!!");zaman.countr++;
  405.                     getch();
  406.                     break;
  407.                     getch();
  408.                 }
  409.                 else
  410.                 {printf("\n\nWrong!!! The correct answer is D. Power On Self Test");
  411.                     getch();
  412.                     goto scoreboard;
  413.                     break;
  414.                 }
  415.  
  416.                 case 16:
  417.                 printf("\n\n    Which is the first mechanical computer?.");
  418.                 printf("\n\nA.The Babbage Difference Engine\t\tB.Abacus\n\nC.Super computer\t\tD.All above these");
  419.                 if (toupper(getch())=='A')
  420.                 {
  421.                     printf("\n\nCorrect!!!");zaman.countr++;
  422.                     getch();
  423.                     break;
  424.                     getch();
  425.                 }
  426.                 else
  427.                 {
  428.                     printf("\n\nWrong!!! The correct answer is A.The Babbage Difference Engine");
  429.                     getch();
  430.                     goto scoreboard;
  431.                     break;
  432.                 }
  433.                 case 17:
  434.                 printf("\n\n     MS-Word is an example of ___.");
  435.                 printf("\n\nA. An operating system\t\tB.A processing device\n\nC.Application software \t\tD. An input device ");
  436.                 if (toupper(getch())=='D')
  437.                 {
  438.                     printf("\n\nCorrect!!!");zaman.countr++;
  439.                     getch();
  440.                     break;
  441.                     getch();
  442.                 }
  443.                 else
  444.                 {
  445.                     printf("\n\nWrong!!! The correct answer is  C.An input device ");
  446.                     getch();
  447.                     goto scoreboard;
  448.                     break;
  449.                 }
  450.  
  451.                 case 18:
  452.                 printf("\n\n    A computer cannot *boot* if it does not have the ___.");
  453.                 printf("\n\nA.Compiler\t\tB) Loader \n\nC. Operating system\t\tD.Assembler");
  454.                 if (toupper(getch())=='C')
  455.                 {
  456.                     printf("\n\nCorrect!!!");zaman.countr++;
  457.                     getch();
  458.                     break;
  459.                     getch();
  460.                 }
  461.                 else
  462.                 {
  463.                     printf("\n\nWrong!!! The correct answer is C) Operating system ");
  464.                     getch();
  465.                     goto scoreboard;
  466.                     break;
  467.                 }
  468.                 case 19:
  469.                 printf("\n\nStorage capacity of magnetic disk depends on..  .");
  470.                 printf("\n\nA.disk pack in disk surface \t\tB.tracks per inch of surface \n\nC.bits per inch of tracks \t\tD.All of the above ");
  471.                 if (toupper(getch())=='D')
  472.                 {
  473.                     printf("\n\nCorrect!!!");zaman.countr++;
  474.                     getch();
  475.                     break;
  476.                     getch();
  477.                 }
  478.                 else
  479.                 {
  480.                     printf("\n\nWrong!!! The correct answer is D. All of the above ");
  481.                     getch();
  482.                     goto scoreboard;
  483.                     break;
  484.                 }
  485.  
  486.                 case 20:
  487.                 printf("\n\nWhich key is used in combination with another key to perform a specific task?    .");
  488.                 printf("\n\nA.Function\t\tB.Spacebar\n\nC.Arrow\t\tD.Control");
  489.                 if (toupper(getch())=='D')
  490.                 {
  491.                     printf("\n\nCorrect!!!");zaman.countr++;
  492.                     getch();
  493.                     break;
  494.                     getch();
  495.                 }
  496.                 else
  497.                 {
  498.                     printf("\n\nWrong!!! The correct answer is D. Control");
  499.                     getch();
  500.                     goto scoreboard;
  501.                     break;
  502.                 }
  503.             }
  504.         }
  505.    
  506.     scoreboard:
  507.     {
  508.         system("cls");
  509.         printf("\n\n\t*********************Your Score*********************************");
  510.         printf("\n\n\t******Your Score is %d out of 20******************",zaman.countr);
  511.         getch();
  512.  
  513.         seggestion:
  514.         system("cls");
  515.         if(zaman.countr<8){
  516.         printf("You got %d out of 20!\n", zaman.countr);
  517.         printf("Now, that's not a good grade. But don't let one");
  518.         printf("\nbad grade define your abilities. It's a minor setback.");
  519.         printf("\nHow you choose to overcome it, is what sets you apart from the rest.");
  520.         printf("\nI am going to recommend you a book called \"The C programing language\" by Dennis Ritchie.\n");
  521.         printf("Study this throughly and come back later.\n");
  522.         printf("Hopefully you can do better next time.\n\nGood Luck...");
  523.         }
  524.         else if(zaman.countr>7 && zaman.countr<15){
  525.         printf("You got %d out of 10!\n", zaman.countr);
  526.         printf("It is a good mark. But you need to improve.\n");
  527.         printf("I am going to recommend you a book called \"The C programing language\" by Dennis Ritchie.\n");
  528.         printf("Study this throughly and come back later.\n");
  529.         printf("Hopefully you can do better next time.\n\nGood Luck...");
  530.         }
  531.         else{
  532.         printf("Excellent! You got %d out of 10!\n", zaman.countr);
  533.         printf("You seems pretty good at C programming.\n");
  534.         printf("You now need to move on to next stage.\n");
  535.         printf("You can now study discrete mathematics or DSA.");
  536.         printf("\n\nGood Luck...");
  537.         }
  538.         go:
  539.         puts("\n\n Press Y if you want to play Again?");
  540.         puts("Press any key if you want to go main menu");
  541.         if (toupper(getch())=='Y')
  542.         goto game;
  543.         else{
  544.         goto mainhome;
  545.         }
  546.     }
  547.  
  548.  
  549.  
  550.  
  551. }
  552.  
  553. void help()
  554.     {
  555.         system("cls");
  556.         printf("\n ------------------  Welcome to ZaMaN's c-AI--------------------------");
  557.         printf("\n\n Here are some tips for:          ");
  558.         printf("\n -------------------------------------------------------------------------");
  559.         printf("\n >>Must  Ans two questions to check your Abilities: ");
  560.         printf("\n >>Then Ans 20 Questions: ");
  561.         printf("\n Press any other key to return to the main menu!");
  562.         getch();
  563.     }
  564.  
  565. void about()
  566.     {
  567.         system("cls");
  568.         printf("\n\n\t*********************About Developer*********************************");
  569.         printf("\n\n\t*****ZaMaN's c-AI is Made By ZaMaN4031********");
  570.         printf("\n\n\t*****www.zamansheikh.com********");
  571.         printf("\n\n\t*****Thanks********");
  572.         getch();
  573.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement