C++ GUI
this is what i have so far. (whitey and cody are friends)
#include <iostream> #include <string> #include <vector> #include <dos.h> #include <stdio.h> #include <conio.h> using namespace std;
int main() { // Logins login: cout << "\tLooking Glass\n"; int security = 0; int logged_in = 0; int menu = 0; string user; int submenu; int newSecurity;
string username=" ";
cout << "\nUsername: ";
cin >> username;
string password;
cout << "Password: ";
cin >> password;
if (username == "spencer" ){if ( password == "nowhere")
{
security = 5;
}}
if (username == "whitey" && password == "imgay" )
{
security = 3;
}
if (username == "cody" && password == "imafruit")
{
security = 3;
}
system("cls");
if (security = 5){
if (username == "spencer" && security == 5){
cout << "\nNow logged in Chris.\n";
}
menu: cout << "\n\nMenu:\n\n"; cout << "1 - All users and security\n"; cout << "2 - Programs\n"; cout << "3 - Log out\n"; cin >> submenu; if (submenu == 1){ vector<string> users; users.push_back("Spencer"); users.push_back("Cody"); users.push_back("Whitey");
vector<string>::iterator myIterator;
vector<string>::const_iterator iter;
cout << "All Users:\n";
for (iter = users.begin(); iter != users.end(); ++iter)
cout << *iter << endl;
goto menu;}
}
if (submenu == 2){
cout << "option 2";
}
if (submenu == 3){
security = 0;
system("cls");
goto login;
}
goto login;
system("pause"); return 0;
}
I found this really useful : http://www.winprog.org/tutorial/
Good luck ;)
@yours31f- my first advice to you is to never use goto's. it's just bad form and can lead to nesting errors and such.
also, the user interface is the last thing you should focus on. if you really want to make an OS, you need to get the main body of the code written before you focus on making it 'pretty'.
Wow…just…wow. First thing you post in a few weeks, and I already hate you again. Where to start…
2 weeks and you're trying to write an 'OS'. And you claim that it's so you can learn, yet you come here asking for us to do the research for you. You want advice? Learn how to use google yourself, rather than getting other people to do it for you. Find something easier to do. Stick with the simple stuff until you get a more in-depth view of the language.
I can already see what's going to happen. You're gonna realize that noone here is going to do it for you, so you're going to quit and move onto something harder, then come back and try again.
I've told you to learn the basics before moving on to the harder stuff…at least ten times already, yet you continue to waste everyone's time. So why don't you just do it? Rather than fiddle around for about 15 minutes then come here and bother us, why not find a tutorial online or buy a book and get to work for yourself? When you get some real questions, *then *ask them. And just as clarification, a real quesiton doesn't consist of "I need a tutorial or something."
Thats all for right now. I'm sure I could do more, but suddenly I've lost interest.
yours31f wrote: if (username == "spencer" ){if ( password == "nowhere") { security = 5; }} Why not use two conditions for one if statement instead of two separate ones?
if (username == "spencer" && password == "nowhere") { etc
if (security = 5){
This is NOT good, since it'll actually set the security level to 5 and continue. Should be
if (security == 5){
menu: cout << "\n\nMenu:\n\n"; (some more code…) goto menu;}
Come on man! This isn't batch! Learn how to use functions!
Seems like you have a lot of things to do, but it's a good project to learn stuff anyway. However I don't think you'll be able to code a separate OS depending on windows.h ^^
Hmmm, okay, now i'm confused???????
Are u making a shell replacement or an os or what?
And secondly, why?
When we already have ubuntu, linux, windows, beos, dos and loads of variants.
Maybe u should try writing something a little less challenging and a little more useful if you've only started. There are loads and loads of programs and routines u could write to actuially help you by automating some actions on your pc etc, why not try something like that instead of putting yourself in competition with all the other extremely excellent programmers that already make the os's in the first place.