It's a simple program but somehow it doesn't go on after the switch command. Ya, so some help would be great.
Code:
#include <iostream>
using namespace std;
class cat
{
public:
char name[50];
char eyeclr[15];
char fur[15];
int itsage;
float itsweight;
void meow();
};
void meow(){
cout<< "Meow\n\n";
};
int addition (int a, int b)
{
int c;
c = a + b;
}
int subtraction (int a, int b)
{
int c;
c = a - b;
}
int multiply (int a, int b)
{
int c;
c = a * b;
}
int division (int a, int b)
{
int c;
c = a / b;
}
int main()
{
cat cx;
char action[30];
cout<< "Make your own cat.\n" <<endl;
cout<< "What's its name?: ";
cin>>cx.name;
cout<< endl;
cout<< "What's its eye color?: ";
cin>>cx.eyeclr;
cout<<endl;
cout<< "What's its fur color?: ";
cin>>cx.fur;
cout<< endl;
cout<< "Hi, " <<cx.name << " who has the eye color of ";
cout<< cx.eyeclr << " and who has " << cx.fur << " colored fur.\n";
cout<< "How old is it?: ";
cin>>cx.itsage;
cout<< endl;
cout<< "How much does it weigh?: ";
cin>>cx.itsweight;
cout<< endl;
cout<< "So it's " <<cx.itsage << " and it's " << cx.itsweight << ", cool.\n";
cout<< endl;
cout<< "What would you like " << cx.name << " do?: \n";
cout<< "bark\nmeow\nor quack\n";
cin>> action;
cin.ignore();
cout<< endl;
if (action == "bark" || "BARK" || "Bark") cout<< "Cats can't bark, dogs can!\n";
else if (action == "meow" || "MEOW" || "Meow") cout<< "Meow\n";
else {
cout<< "Cats can't quack! Ducks can!\n";
}
}
char ans1[10];
cout<< "Would you like to teach mathematics to it? (y or n): \n";
cin>> ans1;
if (ans1 == "y") {
char form;
int t1, t2, t3, t4, t5, t6, t7, t8, t9, t10;
char learn[10];
cout<< "Choose a formula: ";
cout<< endl << "addition\n";
cout<< "subtraction\n";
cin>> form;
cin.ignore();
switch ("addition" || "subtraction")
{
case 0:
cout<< "Let's just stick between 1 and 10. (1+1=2, 1+2=3 format only): \n";
cin>>t1;
cout<< endl;
cin>>t2;
cout<< endl;
cin>>t3;
cout<< endl;
cin>>t4;
cout<< endl;
cin>>t5;
cout<< endl;
cin>>t6;
cout<< endl;
cin>>t7;
cout<< endl;
cin>>t8;
cout<< endl;
cin>>t9;
cout<< endl;
cin>>t10;
cout<< endl;
cout<< endl;
cout<< cx.name << " has learned all that, but sadly I don't think he can learn anymore.\n";
cout<< "would you like to see what he has learned? (y or n)\n";
cin>>learn;
if (learn == "y"){
cout<< "Show us what you know " <<cx.name;
void meow();
cout<<t1;
cout<< endl;
cout<<t2;
cout<< endl;
cout<<t3;
cout<< endl;
cout<<t4;
cout<< endl;
cout<<t5;
cout<< endl;
cout<<t6;
cout<< endl;
cout<<t7;
cout<< endl;
cout<<t8;
cout<< endl;
cout<<t9;
cout<< endl;
cout<<t10;
cout<< endl;
cout<< endl;
}
else {
cin>>learn;
}
cout<< "I think " <<cx.name << " is getting sleepy now.\n Bye-bye!";
break;
case 1:
cout<< "Let's just stick between 1 and 10. (10-1=9, 10-2=8 format only): \n";
cin>>t1;
cout<< endl;
cin>>t2;
cout<< endl;
cin>>t3;
cout<< endl;
cin>>t4;
cout<< endl;
cin>>t5;
cout<< endl;
cin>>t6;
cout<< endl;
cin>>t7;
cout<< endl;
cin>>t8;
cout<< endl;
cin>>t9;
cout<< endl;
cin>>t10;
cout<< endl;
cout<< endl;
cout<< cx.name << " has learned all that, but sadly I don't think he can learn anymore.\n";
cout<< "would you like to see what he has learned? (y or n)\n";
cin>>learn;
if (learn == "y"){
cout<< "Show us what you know " <<cx.name;
void meow();
cout<<t1;
cout<< endl;
cout<<t2;
cout<< endl;
cout<<t3;
cout<< endl;
cout<<t4;
cout<< endl;
cout<<t5;
cout<< endl;
cout<<t6;
cout<< endl;
cout<<t7;
cout<< endl;
cout<<t8;
cout<< endl;
cout<<t9;
cout<< endl;
cout<<t10;
cout<< endl;
cout<< endl;
}
else {
cin>>learn;
}
cout<< "I think " <<cx.name << " is getting sleepy now.\n Bye-bye!";
break;
default:
cout<< "Choose a formula: ";
cout<< endl << "addition\n";
cout<< "subtraction\n";
cout<< "multiplication\n";
cout<< "division\n";
cin>> form;
cin.ignore();
}
}
cin.get();
return 0;
}