Thread: Help with my Questionaire Program

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    Did you change all your if() statements?

    Post your latest code - we've no way of knowing what you've done to break it.

  2. #2
    Registered User
    Join Date
    Nov 2005
    Posts
    11
    here is the code now:-

    BTW i got a friend to help me fix it but i have a new problem..

    Code:
    // questionaire.cpp
    
    #include <iostream>
    #include <windows.h>
    #include <string.h>
    using namespace std;
    const int ANS = 80;
    
    void fullscreen()
    {
    keybd_event(VK_MENU,0x38,0,0);
    keybd_event(VK_RETURN,0x1c,0,0);
    keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
    keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
    }
    
    class Questionaire
    {
          public:
          void Showcreator()
          {
               cout << "         **********[QUESTIONAIRE 1.0 by aBz]**********                 Score";
          }
          void Myansweris()
          {
               cout << "\n My Answer is:- ";
          }
          void Right()
          {
               cout << "\nCONGRATULATIONS! You got the right answer!";
               cout << "\nPress any key to proceed.";
               cin.ignore();
               system("cls");
          }
          void Wrong()
          {
               cout << "\nWRONG!!!";
               cout << "\nPress any key to try again.";
               cin.ignore();
               system("cls");
          }
    };
    
    int main()
    
    {
           
           char choice = 'x';
           char Answer[ANS];
           
           Questionaire selection;
           
    q1:
           selection.Showcreator();
           cout << "\n\nQ1. What is the capital of Turkey?";
           selection.Myansweris();
           cin.getline(Answer,ANS);
           if( strcmp(Answer,"Ankara") == 0 || strcmp(Answer,"ankara") == 0 )
    	   {
               selection.Right(); 
           }
    	   else 
           {
    		   selection.Wrong();                   
               goto q1;
    	   }
    q2:
           selection.Showcreator();
           cout << "\n\nQ2. What is the capital of Egypt?";
           selection.Myansweris();
           cin.getline(Answer,ANS);
           if( strcmp(Answer,"Cairo") == 0 || strcmp(Answer,"cairo") == 0 )
    	   {
               selection.Right();
           }
    	   else 
           {
    		   selection.Wrong();          
    		   goto q2;
    	   }
    q3:
           selection.Showcreator();
           cout << "\n\nQ3. What is the capital of Iraq?";
           selection.Myansweris();
           cin.getline(Answer,ANS);
           if( strcmp(Answer,"Baghdad") == 0 || strcmp(Answer,"baghdad") == 0 )
           {
               selection.Right();
    	   }
           else 
           {
    		   selection.Wrong();         
               goto q3;
    	   }
    	   
    }
    I want to put in a basic score system. what code do i use to add integers to a variable?
    Last edited by danepporambo; 11-24-2005 at 07:57 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM