Need help with this program I'm trying to make

This is a discussion on Need help with this program I'm trying to make within the C++ Programming forums, part of the General Programming Boards category; I'm trying to make a program that ask you to make a user name and password and store it but ...

  1. #1
    Registered User Sshakey6791's Avatar
    Join Date
    Nov 2008
    Location
    -
    Posts
    57

    Need help with this program I'm trying to make

    I'm trying to make a program that ask you to make a user name and password and store it but i have no idea how to store it. here's what i have so far it is just the basic out line so you know what I'm talking about.
    Code:
    #include <iostream>
    #include <stdio.h>
    #include <string>
    
    
    using namespace std;
    
    string C_UserName; // Creat a username
    string C_PassWord; // creat a password
    char UserName[26]; // If you all ready have an account
    char PassWord[26]; // if you all ready have an account
    
    string CreatAcc; // Creating a account or not.
    
    int main() {
    
    	cout << "Creat Account \n>";
    	cin >> CreatAcc;
    
    	if ( ( CreatAcc == "Yes" ) || ( CreatAcc == "yes" ) ) {
    
    
    		cout << "Creat Username \n>";
    		getline (cin, C_UserName);
    
    		cout << "Creat Password \n>";
    		getline(cin, C_PassWord);
    
    
    	} else if ( ( CreatAcc == "No" ) || ( CreatAcc == "no" ) ) {
    
    		cout << "Enter your Username \n>";
    		cin >> UserName;
    
    		cout << "Enter your Password \n>";
    		cin >> PassWord;
    
    	} else {
    
    		cout << "ERROR!!!!\n";
    
    	}
    
    
    
    	system ( "Pause" );
    	
    	return(0);
    	
    }
    remember this is a basic out line not even close to being done.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Store it where? In a variable? In a file? Somewhere in the ether?

  3. #3
    Registered User Sshakey6791's Avatar
    Join Date
    Nov 2008
    Location
    -
    Posts
    57
    Store it somewhere so i can get it later like a database.... can you do database in C++..... and if not then mostly a file.

  4. #4
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    SQLite is a small, free, public-domain database that would be a suitable one with which to start.

  5. #5
    Registered User Sshakey6791's Avatar
    Join Date
    Nov 2008
    Location
    -
    Posts
    57
    Thanks, i will have to try that, Now can anyone saw me how to do it with files

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What have you done so far, with regards to files?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User Sshakey6791's Avatar
    Join Date
    Nov 2008
    Location
    -
    Posts
    57
    Nothing to big i know most of the basics

  8. #8
    Registered User
    Join Date
    Aug 2008
    Location
    Belgrade, Serbia
    Posts
    163
    Don't forget that database is just an organized file.
    Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
    What profit hath a man of all his labour which he taketh under the sun?
    All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
    For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Sshakey6791 View Post
    Nothing to big i know most of the basics
    Ok, so why don't have TRY to do something - the point is that you can post to forums and copy the results forever without learning how to ACTUALLY do ANYTHING (except post and copy on forums - which is a useful skill, but not quite as useful as learning things for yourself).

    Post your attempt - if you don't know where to start, try the cprogramming.com tutorials for file handling in C++.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    Registered User
    Join Date
    Oct 2006
    Posts
    2,370
    Quote Originally Posted by tabstop View Post
    Store it where? In a variable? In a file? Somewhere in the ether?
    I prefer to use a rift in space/time to store my data in a subspace field. it seems much more secure than memory, which goes away when power is cut, and even more secure than a disk which can fail at any time. the added bonus is that when I travel through time to observe the history of the universe, my data is accessible from any point in space/time, since it resides in an area outside our universe.

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    Move those global variables inside main, too.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Registered User Sshakey6791's Avatar
    Join Date
    Nov 2008
    Location
    -
    Posts
    57
    ether way the variables work why would it matter ?

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,650
    Quote Originally Posted by Sshakey6791
    ether way the variables work why would it matter ?
    When you begin to introduce functions other than main, you may find that the variables do not work as you expected, since you may get confused between variables in local scope and those in global scope.

    Maintenance and bug fixing becomes more difficult because it is harder to reason about the state of a global variable, so it is harder to determine the full effects of a change that involves a global variable. Your functions become harder to reuse because they are tightly coupled to the global variables.
    Last edited by laserlight; 12-01-2008 at 12:48 PM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    Quote Originally Posted by Wikipedia
    The use of global variables makes software harder to read and understand. Since any code anywhere in the program can change the value of the variable at any time, understanding the use of the variable may entail understanding a large portion of the program. They make separating code into reusable libraries more difficult because many systems (such as DLLs) don't directly support viewing global variables in other modules. They can lead to problems of naming because a global variable makes a name dangerous to use for any other local or object scope variable. A local variable of the same name can shield the global variable from access, again leading to harder to understand code. The setting of a global variable can create side effects that are hard to understand and predict. The use of globals make it more difficult to isolate units of code for purposes of unit testing, thus they can directly contribute to lowering the quality of the code.
    http://en.wikipedia.org/wiki/Global_variables
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    Registered User Sshakey6791's Avatar
    Join Date
    Nov 2008
    Location
    -
    Posts
    57
    Thanks Never looked at it that way.....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 02:30 PM
  2. Replies: 9
    Last Post: 06-17-2008, 11:38 AM
  3. want to make this small program...
    By psycho88 in forum C++ Programming
    Replies: 8
    Last Post: 11-30-2005, 01:05 AM
  4. How To Make The Program Installed In Program Files Folder?
    By javacvb in forum Windows Programming
    Replies: 4
    Last Post: 11-05-2003, 04:33 PM
  5. any suggestions on how to make this program smaller?
    By bajan_elf in forum C++ Programming
    Replies: 4
    Last Post: 05-12-2003, 03:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21