Use a case then function, so you would get whatever data you needed from the cases, whether a bool, int or char then you would send it to a function to do the work.
#include <iostream>
int main()
{
int num = 0;
std::cout << "Enter a number from 1 to 3 ";
std::cin >> num;
switch (num)
{
case (1):
std::cout << "One";
break;
case (2):
std::cout << "Two";
break;
case (3):
std::cout << "Three";
break;
default:
std::cout << "Number not 1-3";
break;
}
}
I basically copied and pasted the code from the above
#include <iostream.h>
int main()
{
int num = 0;
std::cout << "Enter a number from 1 to 3 ";
std::cin >> num;
switch (num)
{
case (1):
std::cout << "One";
break;
case (2):
std::cout << "Two";
break;
case (3):
std::cout << "Three";
break;
default:
std::cout << "Number not 1-3";
break;
}
}
Thanks guys but now I am right out of here lost. compile as c++ code my file name is 3.c the above is so so alien to me. Visual c++ well this is just out my capabilities I think