Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 23rd, 2006, 2:14 AM   #11
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
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.
Twilight is offline   Reply With Quote
Old May 23rd, 2006, 3:57 AM   #12
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
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.
Twilight is offline   Reply With Quote
Old May 23rd, 2006, 4:35 AM   #13
Mack1982
Programmer
 
Join Date: Dec 2004
Posts: 34
Rep Power: 0 Mack1982 is on a distinguished road
If u did send it to me,..please,..
Mansoor1982@yahoo.com
Mack1982 is offline   Reply With Quote
Old May 23rd, 2006, 8:15 AM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old May 23rd, 2006, 12:08 PM   #15
Mack1982
Programmer
 
Join Date: Dec 2004
Posts: 34
Rep Power: 0 Mack1982 is on a distinguished road
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,...
Mack1982 is offline   Reply With Quote
Old May 23rd, 2006, 4:05 PM   #16
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
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.
Twilight is offline   Reply With Quote
Old May 23rd, 2006, 4:13 PM   #17
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
Originally Posted by Rule 14
Dont give us YOUR homework questions - Dont be so lazy. If you post your homework for someone else todo, dont be supprised or get upset if your post is removed. Asking for a brief pointer on a *particular area* IS ok. Copying of multiple assignment questions and attaching a note at the bottom saying "please help me" is not. We were all at school/college/uni once upon a time, and we know what homework questions look like
Besides being against the rules, doing someone's homework for them is NOT doing them any favors. First, they don't learn. Secondly, in one case I'm aware of, a student was flunked entirely because his instructor happened to see the thread.
__________________
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
DaWei is offline   Reply With Quote
Old May 23rd, 2006, 9:22 PM   #18
Mack1982
Programmer
 
Join Date: Dec 2004
Posts: 34
Rep Power: 0 Mack1982 is on a distinguished road
ooh,.. i didn't know about it,.. Sorry,...
Mack1982 is offline   Reply With Quote
Old May 23rd, 2006, 9:35 PM   #19
Mack1982
Programmer
 
Join Date: Dec 2004
Posts: 34
Rep Power: 0 Mack1982 is on a distinguished road
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?)
G

Because 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()
Mack1982 is offline   Reply With Quote
Old May 23rd, 2006, 9:47 PM   #20
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:30 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC