473,387 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Using Multiple Getlines() Language: C++

Why can't I use multiple getlines()

C++ Code:


#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>

using namespace std;

int main()
{
int choice=0;
while(choice<6)
{
cout << "1. Add Entry Name, age and address" << endl;
cout << "2. Edit Information" << endl;
cout << "3. Delete Information" << endl;
cout << "4. View" << endl;
cout << "5. Exit program" << endl;
cout << "Please pick a choice" << endl;
cin >> choice;
if(choice==1)
{
cout << "You chose to add an entry" << endl;
cout << "Please enter your full name:" << endl;
string name;
getline(cin,name);
cout << "Please enter your age:" << endl;
string age;
getline(cin,age);
cout << "Please enter your address:" << endl;
string address;
getline(cin, address);
ofstream myfile;
myfile.open("C:\\users\\APAdalian15\\Desktop\\User _Information.txt");
cout <<"Creating new file... Please wait..." << endl;
myfile << name << endl;
myfile << age << endl;
myfile << address << endl;
myfile.close();
}



system("PAUSE");
return 0;
}
}
Jan 28 '12 #1
3 2151
Someone please reply!
Jan 28 '12 #2
weaknessforcats
9,208 Expert Mod 8TB
You have a return 0 inside your while loop. You hit it on the first pass and out you go.
Jan 29 '12 #3
@weaknessforcats
Thanks man! Will try it out!
Jan 29 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: steve | last post by:
I'm new to XML, so pardon the stupid question. I've looked thru several books with not luck. All I want to do is associate one xml file with multiple xsl stylesheets. For example, if the user...
5
by: | last post by:
Hi all, HttpWebRequest, and SoapHttpClientProtocol both expose a ClientCertificates property, which can hold multiple client certificates, but on the service side, it can only receive one client...
0
by: dtrudell75 | last post by:
Hi there, I'm running Visual Basic .Net 2003 and developing a windows mobile 2003 application. I'm using the following code to create and dispose of forms, but I'm running into a Stack...
0
by: Jonas | last post by:
I'm migrating one of our systems from .NET 1.1 and VS2003 to .NET 2.0 and VS2005 and ran in to trouble we are using multiple solutions. To clarify the problem, say we have three projects:...
1
by: Kush | last post by:
Hi. If I am going to be using multiple tapes to backup a rather large database , then do I have to initialize ALL the tapes beforehand to the same blocksize or the backup command will take care...
1
by: intscript | last post by:
Hi everyone Is is possible to retrieve data using multiple select. Here is my SQL code: select sum(nPassengers) Planned, Actual, (sum(Planned) - Actual) Variance from ( select iDeptCode,...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
3
by: Matt | last post by:
Hey guys. I'm currently working through a number of C programming exercises to get me up to speed with the syntax. Before now I have been using Fortran and I've found Plato3 in Windows to be an...
2
by: DJ Dharme | last post by:
Hi all, I am writing a multi-threaded application in c++ running on solaris. I have a file which is updated by a single thread by appending data into the file and at same time the other threads...
3
by: modernshoggoth | last post by:
G'day all, I'm trying to update a single table (containing plans for flights) with information from the same and other tables (containing info for organisations and locations). tblFlightPlans...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.