ok, i'm new to c++ and trying to learn it on my own. i've been doing not that bad...until i reached the point of classes. i copied the code from "teach yourself c++ in 21 days" and decided to augment it to ask the user for a certain piece of input. here is the augmented code:
i hope i did that right. any road....when i run it, well here is a sample output:Code:#include <cstdlib> #include <iostream> class cat { public: int itsAge; int itsWeight; }; using namespace std; int main(int argc, char *argv[]) { int x; cat frisky; frisky.itsAge = x; cout << "How old is frisky?\n"; cin >> x; cout << "Frisky is a cat who is "; cout << frisky.itsAge << " years old.\n"; system("PAUSE"); return EXIT_SUCCESS; }
How old is frisky?
5
Frisky is a cat who is 2 years old
press any key to continue....
ok, where the duce is the 2 coming from. i never declared x to = 2, it was supposed to be user defined. help please? thank you in advance....