Author Topic: My program doesn`t work properly  (Read 940 times)

Gabbe

  • Guest
My program doesn`t work properly
« on: 8 May 2011, 19:57:31 »
It compiles fine, but i think i have messed up the if statements somewere, wich i am too stupid to see. Help?

Code: [Select]
#include <string>
#include <limits>
using namespace std;
     
int main()
{
     
    int number;
    string name;
    string gname;
    int variable;
    char yesno[10];
    char girlorboy[10];
   
   
    cout << "This is a test program \nIt tests User Input and Output\n\n";
   
    cout << "Please enter your age: ";
   
    cin >> number;
   
    cin.ignore(numeric_limits<streamsize>::max(), '\n');
   
    cout << "Please enter your name: ";
   
    getline(cin, name);
   
    cout << endl;
   
    cout << "Please enter your sex, either female or male: ";
   
    cin >> girlorboy;
   
    if (!strcmp (girlorboy, "male")){
   
        cout << "Your full name is " << name << ", and your age is " << number << endl;
   
        cout << "\n" << name;
   
        cout << " are allowed to date girls with the age: ";
   
        cout << number / 2 + 7 << " and upwards!\n\n";
   
        cout << "Now, " << name << ", please enter the name of a girl within the age limit: ";
   
        getline(cin, gname);
   
        cout << "\nSince i am an all-knowing computer, i foresee that you, " << name << ", fits perfectly";
   
        cout << " with " << gname << "!\n";
   
        cout << "is this true? Yes or no. You don`t have to answer.. ";
   
        cin >> yesno;
   
        if (!strcmp(yesno, "yes")) {
                       
                cout << "See im still all knowing! Bow to the almighty computer! " << endl;
           
                cout << "It knows the asnwer to everything";
           
                }
           
        else if (!strcmp(yesno, "no")){
         
             cout << "Don't lie to yourself, I know I am right! ";
         
             }
   
        cout << "good dat...we are no longer bros..";
               
               }
               
        else if (!strcmp(girlorboy, "female")){
             cout << "girls don`t count...";
                  }
   
        system("pause");
        cin.get();
        return 0;
}


 

anything