Thread: help once agen

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    47

    Post help once agen

    i have a code and it says my funtion can be a return type and something about it being new...
    here it is:
    Code:
    #include <iostream>
    
    using namespace std;
    
    int emp,id_number,money,rank;
    struct variable
    {
           int id_number;
           int money;
           int rank;
    }
    
    void wtf (int id_number,int money,int rank)
    {
         cout<<"employee# :"<<id_number<<endl;
         cout<<"employee wages :"<<money<<endl;
         cout<<"rank :";
         switch (rank)
         {
                case 1:
                     cout<<"Low";
                case 2:
                     cout<<"medum";
                case 3:
                     cout<<"High";
                case 4:
                     cout<<"Maneger";
         }
         cout<<endl;
         cin.get();
    }
    
    int main()
    {
        cout<<"Number of employee's?"<<endl;
        cin>> emp;
        while (emp >= 1)
        {
              //start
              variable employee;
              cout<<"Id number?"<<endl;
              cin>> employee.id_number;
              cout<<"salery?"<<endl;
              cin>> employee.money;
              cout<<"level of employment?"<<endl;
              cin>> employee.rank;
              wtf (id_number,money,rank);
              cout<<"----------------------------------------------------------"<<endl;
        }
        cin.get();
    }

  2. #2
    FOX
    Join Date
    May 2005
    Posts
    188
    You forgot the closing ; in your struct. Change to:
    Code:
    struct variable
    {
           int id_number;
           int money;
           int rank;
    };

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    722
    there's no real point for those global vars...
    place them inside main

Popular pages Recent additions subscribe to a feed