473,385 Members | 1,292 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,385 software developers and data experts.

some error in a program

Hi!!!!!!!, I want to read two strings that the user must enter, and i am doing it this way:

cout << "Please enter the text that you want to Encrypt (128 bits legth)" << endl;
getline (cin, a);

length1 = a.size();

cout << "Please enter the key to Encrypt the text (128 bits legth and Hex format)" << endl;
getline (cin, b);
length2 = b.size();

and I have a problem, because I don't why this program does not read the second one, could you please tell me how can I read the two strings (the problem is that the instruction getline (cin, b);, does not execute). Thank you
Sep 18 '06 #1
1 1219
tyreld
144 100+
Hi!!!!!!!, I want to read two strings that the user must enter, and i am doing it this way:

cout << "Please enter the text that you want to Encrypt (128 bits legth)" << endl;
getline (cin, a);

length1 = a.size();

cout << "Please enter the key to Encrypt the text (128 bits legth and Hex format)" << endl;
getline (cin, b);
length2 = b.size();

and I have a problem, because I don't why this program does not read the second one, could you please tell me how can I read the two strings (the problem is that the instruction getline (cin, b);, does not execute). Thank you
Often times the cout buffer is not flushed completly. Try adding a "cout.flush()" after each cout statement.

Expand|Select|Wrap|Line Numbers
  1.  
  2. cout << "Please enter the ..." << endl;
  3. cout.flush();
  4. getline(cin, some_variable);
  5.  
  6.  
Sep 18 '06 #2

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

Similar topics

7
by: Silver | last post by:
First of all...merry christmas everyone! Now, I have to write a program. Among other things, I need to overload the '*' operator, so that it returns a pointer-to-ponter of type int, which is...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
1
by: Burton Wilkins | last post by:
Dear Brandon: You sent me some advice before as to how get the DataLink working, but I haven't been able to get your solution to compile: You sent me this: >Hi Burton, I was able to get the...
1
by: Minh | last post by:
I've just installed VS.NET 2003 on my Athlon XP 1800+. However I couldn't get any project with STL includes to compile even if I create a new empty project (and added #include <string>). It gave me...
2
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
4
by: Chris F Clark | last post by:
Please excuse the length of this post, I am unfortunately long-winded, and don't know how to make my postings more brief. I have a C++ class library (and application generator, called Yacc++(r)...
9
by: Prasad | last post by:
HI, I am a beginner in VC++.. I am trying to write a Win32 console application in visual studio.. I am using following header files.. #include <STRING> using namespace std; #include...
11
by: Bob | last post by:
Hi, I compiled an application for the first time with no errors but following warnings: 1) variable declaration withoit an 'AS': Dim def() 2) variable 'myvar' is used before it has been...
19
by: david | last post by:
I took old code and decided to modify it a bit, and I just noticed that it does not compile at all and before server one of severs (main) crashed in the system it was working fine (I am really sure...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.