Thread: cant compile

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

    cant compile

    i am having some problems with this program. i have hilighted the areas in red that have errors.
    Code:
    #include <iostream>
    #include <fstream>
    #include <cstdlib>
    #include <time.h>
    #include <cstring>
    
    struct strct
    {
    	int id_number;
    	float salery;
    	int report;
    };
    
    string name;
    string position;
    string read;
    int x,y,max,min;
    
    void name_id_promp();
    void salery();
    void lvl_of_employment();
    void evaluate();
    void save();
    void clse();
    int randombet(int max,int min);
    
    int main()
    {
    	while(x != 0)
    	{
    	time_t seconds;
        time(&seconds);
        srand((unsigned int) seconds);
    
    	strct numb;
    	ofstream data_1( "C:\Documents and Settings\steven bayer\My Documents\employee",iso::app );
    	data_1.close();
    	ifstream data( "C:\Documents and Settings\steven bayer\My Documents\employee",iso::app );
    	if( !data.isopen() )
    		cout<<"File could not be opened. \nreason not sepcified"<<endl;
    	else
    	{
    		cout<<"menu \n"<<"1) add employee \n"<<"2) check database \n"<<"Make a random number"<<endl;
    		cin>> y;
    		switch(y)
    		{
    		case 1:
    			void name_id_promp();
                void salery();
                void lvl_of_employment();
                void evaluate();
                void save();
    		case 2:
    			data>> read;
    			cout<<read<<endl;
    		case 3:
    			cout<<"enter a random max and min"<<endl;
    			cin>>max>>min;
    		default:
    			cout<<"ban input ending program";
    		}
    	}
    	}
    }
    void name_id_promp()
    {
    	cout<<"What is your employees name?"<<endl;
    	cin>>name;
    	cout<<"What is "<<name<<"'s id number?"<<endl;
    	cin>> numb.id_number;
    }
    
    void salery()
    {
    	cout<<"How much is employee ["<<name<<"] being payed per hour"<<endl;
    	cin>> numb.salery;
    }
    
    void lvl_of_employment()
    {
    	cout<<"The level of employment for employee:"<<numb.id_number<<endl;
    	cin>> position;
    }
    
    void evaluate()
    {
    	cout<<"Give a '-5' to '5' value"<<endl;
    	cin>> numb.report;
    }
    void save()
    {
    	data<<name<<endl;
    	data<<numb.id_number<<endl;
    	data<<numb.salery<<endl;;
    	data<<numb.report<<endl;
    	data<<read<<endl<<endl;
    }
    void clse()
    {
    	data.close();
    	cout<<"Program close"<<endl;
    }
    int randombet(int max,int min)
    {
    	cout<<rand() % (max - min + 1) + min;
    }
    and all cout and cin come up undecleared.

  2. #2
    Banned
    Join Date
    Jun 2005
    Posts
    594
    try putting

    using namepsace std;


    after your #includes

    and in your file names try using

    \\

    for the slash

    Ex.

    "c:\\windows\\notepad.exe"

    you should have #include <string>
    instead of #include <cstring>
    Last edited by ILoveVectors; 07-11-2005 at 06:24 PM.

  3. #3
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Might want to make the switch <time.h> -> <ctime> for consistency too...
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C and C++ compile speed
    By swgh in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-02-2007, 02:37 PM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  3. How to compile mfc libs from platform sdk
    By tjcbs in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2006, 08:20 AM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  5. How can I compile C or C++ with Visual Studio .NET?
    By Dakkon in forum C Programming
    Replies: 8
    Last Post: 02-11-2003, 02:58 PM