Solved

URGENT: Simulation of computer network using Container classes

Posted on 2003-11-22
4
217 Views
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

cheers,
anusha
0
Comment
Question by:anushan
4 Comments
 
LVL 3

Expert Comment

by:monkesdb
Comment Utility
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.
0
 
LVL 17

Expert Comment

by:rstaveley
Comment Utility
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.
0
 
LVL 9

Expert Comment

by:tinchos
Comment Utility
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.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
Comment Utility
PAQed - no points refunded (of 300)

SpazMODic
EE Moderator
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now