URGENT: Simulation of computer network using Container classes

Posted on 2003-11-22
Medium Priority
Last Modified: 2010-04-02
I am just starting to learn some C++ programming and would really appreciate some help from you experts *****

The program I am trying to work with will need to perform a simulation of a computer network. The network is represented as a class called comp_network. I am planning to declare this as a container class. This network supports an unlimited number of users and provides password security. It also contains functions to allow you to log-on and log-off of the system, and a way of shutting the network down.

Although this class is simulating a network with this program, there is no reason this class couldn't serve as a front end to a real network. In this capacity, the class could serve as an interface to the network for other computers on the local network. We could then write functions such as check_passwd() and logon() to provide hooks into the real network. Security issues aside, my goal is to make such information private so that the interface to the network doesn't have to change if the implementation details change.

Some things I want this code to do is -->

1. at object creation only 1 user is known, in UNIX this is the superuser called root.

2. this user can add new users, delete users, and print lists of users.

3. I also would like to add new users to the system, with both names and passwords

4. I would like to  supply a dummy command interface routine that just accepts commands, but doesn't do anything but print a "Finished with <command>" message. This must understand "logoff"

5. need to store a list that is dynamic, it grows with new users and shrinks when they are deleted. Don't need to store this list from program invocation to invocation. Everytime the program is restarted it will only have the original users.

6. logoff will be the command to exit from the simulated dummy command interface session. This brings you back to the user name prompt.

7. a username of done will terminate the program.

I was wondering if the code could utilize the main program given below. My idea was to declare a CONTAINER CLASS called "comp_network" and another class called "user".

main() {

comp_network cplusplus;

cplusplus.install(); // installs known users/passwords

cplusplus.operate_net(); //prints opening message

//and prompts for user and

//password, then goes into

//the command loop

// a username of "done" will

// finish the program


**** I would really appreciate it if some one could help me with some coding for this..as I am just getting the feel of C++ now..thanks a lot

Question by:anushan
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 9803570
well, homework, you should start with more simple homework. and when that homework becomes easy, just build up and build up until you really do don't need to ask people to do your homework for you.
LVL 17

Expert Comment

ID: 9804240
URGENT? I hope not.

monkesdb's advice is good: start with something simpler. It doesn't sound like a homework assignment to me, because I can't imagine a professor setting a task like this. If this was assigned by a professor, it is time to change your course. You want to be able to count your successes in smaller steps.

However, if you like the context, and want to use it to teach yourself C++, and this isn't really URGENT, there's nothing wrong with what you have in main(), but you've got a long way to go before you'll get to flesh out that skeleton.

(1) Try defining a class for a user and see if you can put hard-coded data into it in a stand alone test program and then display it. Then pat yourself on the back.

(2) See if you can enter data into the class interactively. Success? Another pat on the back.

(3) If you are not familiar with the standard library containers (otherwise known as STL), set yourself some assignments to try putting simple data into containers and extracting them, before attempting to put an instance of your user class into the container.

(4) ....

If and when you get snagged on these more managable mini-assignments, EE is an excellent resource; but do make each problem a separate question, and please try to make the subject line relevant to the assignment. You are not going to get much sympathy from experts if you post a question: "URGENT: Need to write my own operating system", but you will get good responses even with modest points (we were all penniless students once), if you post focused queries.

Best of luck.

Expert Comment

ID: 10285732
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ - no points refunded

Please leave any comments here within the next seven days.

EE Cleanup Volunteer

Accepted Solution

SpazMODic earned 0 total points
ID: 10347354
PAQed - no points refunded (of 300)

EE Moderator

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question