Solved

URGENT: Simulation of computer network using Container classes

Posted on 2003-11-22
4
220 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
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.
0
 
LVL 17

Expert Comment

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

Expert Comment

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

Tinchos
EE Cleanup Volunteer
0
 

Accepted Solution

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

SpazMODic
EE Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

920 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

15 Experts available now in Live!

Get 1:1 Help Now