Home Forums C Programming inline function Reply To: inline function

#3259
S.Thananchayan
Participant
#include 
using namespace std;
void Menu();
int GetSomething();
inline void do_something (char* a)
{
 cout << a  << endl;
}
inline void do_something_else (char* b)
{
 cout << b << endl;
}
inline void and_even_more (char* c)
{
 cout << c << endl;
}
int main()
{
 int loop;
 int z;
 for (loop = 0; loop < 10; loop++)
  do_something("Dont taze me bro");
 cout << "Press 1 or 2 for answer";
 cin >>z;
 if (z==1)
  do_something_else("now you do what they told ya");
 if (z==2)
  and_even_more("Everyone fear the machine");
 else
  
    Menu();
  
    int fun;
    fun = GetSomething();
  
    switch (fun)  {
        case 1:
            std::cout << "Wee" << std::endl;
            break;
        case 2:
            std::cout << "Dude" << std::endl;
            break;
        case 3:
            std::cout << "Quitting" << std::endl;
            break;
        default:
            std::cout << "aInvalid selection" << std::endl;
            break;
    }
    return 0;
}
void Menu()
{
    std::cout << "--- Menu ---" << endl;
    std::cout << "1=Wee" << endl;
    std::cout << "2=Dude" << endl;
    std::cout << "3=Quit" << endl;
}
int GetSomething()
{
    int selection;
    std::cout << "Enter Selection: ";
    std::cin >> selection;
    return selection;
}