Hey guys, this is my first full program involving classes, so I'm not sure if I'm way off.
It keeps saying that my 'main' looks like a function definition... am i missing something?Code:#include <iostream> using namespace std; class Dog { char dogName[20]; void Dog::speak(char dogName); }; class Cat { char catName[20]; void Cat::speak(char catName); }; char animal[5]; void Dog::speak(char dogName) { cout<<"\nPlease enter the name of the dog in question: "; cin>>dogName; cout<<"The dog "<<dogName<<" says bark bark"<<endl; } void Cat::speak(char catName) { cout<<"\nPlease enter the name of the cat in question: "; cin>>catName; cout<<"The cat "<<catName<<" says meow."<<endl; } void main { cout<<"Would you like to know about a cat or a dog?"<<; cin>>animal; if animal == "cat" || "Cat" || "CAT"; Cat.speak(); else Dog.speak(); std::cin.clear(); std::cin.ignore(); getchar(); }



LinkBack URL
About LinkBacks



