got prob with this small program
Hi, this is a really small crappy thing that tons of people have done so i thought id give it a go lol.
i thought it looked ok but it wont work.
Code:
#include <iostream>
using namespace std;
int main()
{
int age;
int answer;
int x = 4;
int z;
cout << "Cat or Dog?: \n";
cin >> z;
if(z == Cat || cat || CAT || CAt || CaT || cAT || caT || cAt);
{
cout << "Ok, enter the cats age: ";
cin >> age;
(answer = age * x);
cout <<"Your cat is: \n";
cout << answer;
cout<<"in cat years\n" << endl;
}
if(z == Dog || dog || DOG || DOg || DoG || DoG || dOG || doG);
{ cout << "Ok, enter the dogs age: ";
cin >> age;
(answer = age * x);
cout <<"Your dog is: \n";
cout << answer;
cout <<"in dog years!\n" << endl;
}
else
{
cout <<"That is not a cat or dog fool!" << endl;
}
system("PAUSE");
return 0;
}
error is
Code:
------ Build started: Project: mine, Configuration: Debug Win32 ------
Compiling...
mine.cpp
.\mine.cpp(15) : error C2065: 'Cat' : undeclared identifier
.\mine.cpp(15) : error C2065: 'cat' : undeclared identifier
.\mine.cpp(15) : error C2065: 'CAT' : undeclared identifier
.\mine.cpp(15) : error C2065: 'CAt' : undeclared identifier
.\mine.cpp(15) : error C2065: 'CaT' : undeclared identifier
.\mine.cpp(15) : error C2065: 'cAT' : undeclared identifier
.\mine.cpp(15) : error C2065: 'caT' : undeclared identifier
.\mine.cpp(15) : error C2065: 'cAt' : undeclared identifier
.\mine.cpp(26) : error C2065: 'Dog' : undeclared identifier
.\mine.cpp(26) : error C2065: 'dog' : undeclared identifier
.\mine.cpp(26) : error C2065: 'DOG' : undeclared identifier
.\mine.cpp(26) : error C2065: 'DOg' : undeclared identifier
.\mine.cpp(26) : error C2065: 'DoG' : undeclared identifier
.\mine.cpp(26) : error C2065: 'dOG' : undeclared identifier
.\mine.cpp(26) : error C2065: 'doG' : undeclared identifier
.\mine.cpp(37) : error C2181: illegal else without matching if
Build log was saved at "file://c:\Documents and Settings\Reece.LAPTOP\My Documents\Visual Studio 2005\Projects\mine\mine\Debug\BuildLog.htm"
mine - 16 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
sorry, but im learning still and it is really bugging me.