![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Programmer
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3
![]() |
Yeah, what Uman wrote is pretty much how you'll do it. Then all main needs is a simple loop to output all the employees in your list.
|
|
|
|
|
|
#12 |
|
Programmer
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3
![]() |
Yeah, use lists. The whole thing is actually fairly simple. I decided to do it on a whim, used a list and strings, the whole thing took about an hour of mostly copying and pasting.
|
|
|
|
|
|
#13 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
If u did send it to me,..please,..
Mansoor1982@yahoo.com |
|
|
|
|
|
#14 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
You got help. Do your own homework.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#15 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
I don't want the entire code,.. Just the menu part,.. How did he do use a menu to Add and list employees,..? or perhaps a similar example would do to,...
|
|
|
|
|
|
#16 |
|
Programmer
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3
![]() |
The menu was the easiest part. I just had something like the following:
std::list<Employee*> employees;
int main()
{
string choice;
while(1)
{
cout << "Decribe the options you want the user to choose from" << endl;
cin >> choice;
//parse choice from a string to an int
switch(int version of choice)
{
case 1:
//do choice1 stuff
system("cls");
break;
case 2:
//do choice2 stuff
system("cls");
break;
case 3:
//quit
return 0;
default:
system("cls");
cout << "Invalid selection, ";
}
}
}This just loops forever until the user chooses your quit option. And by adding more cases, you can add more options for the user. |
|
|
|
|
|
#17 | |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Quote:
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
|
#18 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
ooh,.. i didn't know about it,.. Sorry,...
|
|
|
|
|
|
#19 |
|
Programmer
Join Date: Dec 2004
Posts: 34
Rep Power: 0
![]() |
what does this error mean
First.cpp
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2143: syntax error : missing ';' before 'string'
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2059: syntax error : 'string'
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2143: syntax error : missing ';' before '{'
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2447: '{' : missing function header (old-style formal list?)
main.cpp
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2143: syntax error : missing ';' before 'string'
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2059: syntax error : 'string'
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2143: syntax error : missing ';' before '{'
f:\program files\microsoft visual studio 8\vc\include\sal.h(226) : error C2447: '{' : missing function header (old-style formal list?)
GBecause I didn't use any Sal.h in my program. This thing just pops up and all the errors are in here, no in my code. my MAIN #include "first.h" #include <iostream> #include <string> using namespace std; int main() |
|
|
|
|
|
#20 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Perhaps one of the include files is including another file. Looks like it. You also have another source file, First.cpp, which may have other includes in it. Information is key, both for debugging and for seeking help. Be sure and think about what you want to know and what you need to express to get there. The meaning of error messages is expanded on slightly in the help files. One should begin there. You will find that messages similar to yours are often caused by a variable (or type) not being defined. Check for matching braces, also.
One presumes that you hadn't gotten around to reading the rules. Those, the FAQ (which is the same thing, here), and posting guidelines are the first place you should turn when you begin with a forum. It gives you a sense of the community's preferences and style.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|