#include <iostream>
#include <cstdio>
#include <cstdlib>
usingnamespace std;
int main (int nNumberofArgs, char* pszArgs[])
{
// This part will make all the int
int nYear;
int nHigh;
int nWeight;
//This part starts the game
cout << "Hello and Welcome to HOT OR NOT console edition" << endl;
cout << "I am your host GLADOS , and here are out judege's" << endl;
cout << "Host #1 : CYLIAN , Host #2 : Adrian and Host #3 : MAKSYMILIAN" << endl;
cout << "Lets START THE SHOW !!!! " << endl;
system ("PAUSE");
//This part asks the user for DOB HIGHT AND WEIGHT
cout << "L";
cout << "o";
cout << "a";
cout << "d";
cout << "i";
cout << "n";
cout << "g";
cout << ".";
cout << ".";
cout << ".";
system ("PAUSE");
cout << "Please enter Your YEAR of birth: ";
cin >> nYear;
cout << "Please enter you hight in cm : ";
cin >> nHigh;
cout << "And finnaly enter your Weight in kg : ";
cin >> nWeight;
//This part will calculate is the user HOT OR NOT
cout << "Calculating Please Wait";
if (nYear < 1980)(nHigh < 190) (nWeight < 80)
cout << "You are HOT";
else
cout << "You are not hot";
system ("PAUSE");
return 0;
}
Error Log
1 2 3 4 5 6 7
Compiling: main.cpp
C:\Users\Adek\Desktop\Beginning_Programing-CPP\Old or not\main.cpp: In function 'int main(int, char**)':
C:\Users\Adek\Desktop\Beginning_Programing-CPP\Old or not\main.cpp:53: error: '(nHigh <= 189)' cannot be used as a function
C:\Users\Adek\Desktop\Beginning_Programing-CPP\Old or not\main.cpp:55: error: expected ';' before 'cout'
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings
Compiling: main.cpp
C:\Users\Adek\Desktop\Beginning_Programing-CPP\Old or not\main.cpp: In function 'int main(int, char**)':
C:\Users\Adek\Desktop\Beginning_Programing-CPP\Old or not\main.cpp:53: error: '(nHigh <= 189)' cannot be used as a function
C:\Users\Adek\Desktop\Beginning_Programing-CPP\Old or not\main.cpp:57: error: 'else' without a previous 'if'
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings
if (nYear < 1980)(nHigh < 190) (nWeight < 80)
cout << "You are HOT";
else
cout << "You are not hot";
should be
1 2 3 4 5 6 7 8
if ( ( nYear < 1980 ) && ( nHigh < 190 ) && ( nWeight < 480 ) )
{
cout << "You are HOT";
}
else
{
cout << "You are not hot";
}
also you should initialize your ints... it won't make much of a difference here but it's good practice
1 2 3
int nYear;
int nHigh;
int nWeight;
should be
1 2 3
int nYear = 0;
int nHigh = 0;
int nWeight = 0;
aside from that you are doing other weird stuff. Go outside and walk around for a while or something then come back and read your code a couple times and ask yourself... "WTF?!?"
Alright man, I took some time and edited a bit in the program, It's much better now. It will now tell you what is wrong with you instead of "You're not hot!" and it actually RUNS xD.
#include <iostream>
#include <cstdio>
#include <cstdlib>
usingnamespace std;
int main (int nNumberofArgs, char* pszArgs[])
{
// This part will make all the int
int nYear = 0;
int nHigh = 0;
int nWeight = 0;
//This part starts the game
cout << "Hello and Welcome to HOT OR NOT console edition" << endl;
cout << "I am your host GLADOS , and here are out judege's" << endl;
cout << "Host #1 : CYLIAN , Host #2 : Adrian and Host #3 : MAKSYMILIAN" << endl;
cout << "Lets START THE SHOW !!!! " << endl;
system ("PAUSE");
//This part asks the user for DOB HIGHT AND WEIGHT
cout << "L\n";
cout << "o\n";
cout << "a\n";
cout << "d\n";
cout << "i\n";
cout << "n\n";
cout << "g\n";
cout << ".\n";
cout << ".\n";
cout << ".\n";
system ("PAUSE");
cout << "Please enter Your YEAR of birth: " << endl;
cin >> nYear;
cout << "Please enter you hight in cm : " << endl;
cin >> nHigh;
cout << "And finnaly enter your Weight in kg : " << endl;
cin >> nWeight;
//This part will calculate is the user HOT OR NOT
cout << "Calculating Please Wait" << endl;
if (nYear < 1980)
{
if(nHigh < 190)
{
if(nWeight < 80)
{
cout << "You are HOT";
}
else
{
cout << "You're too fat!" << endl;
}
}
else
{
cout << "You're too tall!" << endl;
}
}
else
{
cout << "You're too old!" << endl;
}
system ("PAUSE");
return 0;
}
One thing I don't understand is why you were doing a new cout for each letter in Loading... but you didnt have new lines... why not just write it cout << "Loading" << endl;?