Thread: help

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    12

    help

    could someone please tell me where i have made my error i hav included the error cod below the main program



    Code:
    #include <iostream>
    #include <iomanip>
    #include <C:\Documents and Settings\Pat\Desktop\school\prog14.cpp\prog14.cpp\empinfo.h.cpp>
    
    using namespace std;
    
    int main()
    {
    	const int MAX = 25;
    	struct info employee[MAX];
    	int count = 5;
    	char (ret);
    
    	for (int i=0; i<=count; i++)
    	{
    		cout << "input Last Name:"<< endl;
    		cin.getline (employee[i].last1,25);
    		cout << "Input First Name:" << endl;
    		cin.getline (employee[i].first1,25);
    		cout << "Input payrate:" << endl;
    		cin >> employee[i].payrate;
    		cout << "Input Hours Worked:" << endl;
    		cin >> employee[i].hours;
    		cin.get (ret);
    	}
    double wage[5];
    for (int j=0; j<=count; j++)
    {
    wage[j] = employee[j].payrate * employee[j].hours;
    }
    cout << "Wage = " << wage << endl;
    
    	return 0;
    }
    1>c:\documents and settings\pat\desktop\school\prog14.cpp\prog14a.cpp \prog14a.cpp\prog14a.cpp(9) : error C2143: syntax error : missing ';' before 'using'


    Code:
    struct info
    	{
    		char last1 [25];
    		char first1 [25];
    		double payrate;
    		int hours;
    		
    	}

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    Canada
    Posts
    267
    Code:
    #include <C:\Documents and Settings\Pat\Desktop\school\prog14.cpp\prog14.cpp\empinfo.h.cpp>
    it should be in double quotes
    prog14.cpp is a folder?
    empinfo.h.cpp?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Your struct info is missing a final ;

    Your second loop updating the wage array overflows the array.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Nov 2006
    Posts
    12

    Thumbs up thanks

    that was it thank you for the replys. Salem your solved my problem i really appreciate it

  5. #5
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Are you sure you're include statement is right?
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  6. #6
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Name your headr file empinfo.h
    put it into the same folder as cpp file
    include it using
    #include "empinfo.h"
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed