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

Who can help?This is Urgent

i am doing a program where I have to input an equation and from there , there must be only 5 inputs from the keyboard if more than 5 inputs are done the pgm must display an error message. The program is as follows:

int var1, var2, result;
string eq, op;

cout << "Type the equation : ";
cin >> var1 >> op >> var2 >> eq >> result;

example if the user types the equation :
2 + 3 = 5 (5inputs)
but

2 + 3 = 0 + 5 ( invalid bcos more than 5 inputs r done)

how do I do the validation?
Oct 11 '06 #1
1 1425
i am doing a program where I have to input an equation and from there , there must be only 5 inputs from the keyboard if more than 5 inputs are done the pgm must display an error message. The program is as follows:

int var1, var2, result;
string eq, op;

cout << "Type the equation : ";
cin >> var1 >> op >> var2 >> eq >> result;

example if the user types the equation :
2 + 3 = 5 (5inputs)
but

2 + 3 = 0 + 5 ( invalid bcos more than 5 inputs r done)

how do I do the validation?

Use command line arguments instead of reading it from console
or take an input as string expression using cin.getline and later parse the string to operands and operator.
Oct 11 '06 #2

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

Similar topics

2
by: SKC | last post by:
Hi I have already specnt many hrs in getting these resultsets but no success....can anyone help me out please? I need urgent help to retrive the data in the following format: Table 1 : ...
28
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
8
by: Tim::.. | last post by:
Can someone please tell me why I keep getting the following error for some of my web application users but not others??? Even though the application runs from a central webserver??? Thanks for...
7
by: zeyais | last post by:
Here is my HTML: <style> ..leftcolumn{float:left;width:300px;border: 1px solid #ccc} ..rtcolumn{float:left;width:600px;border: 1px solid #ccc} </style> <body> <div class="leftcolumn"...
17
by: Saps | last post by:
Hi all. Can anyone help me here. I have loads of .sql files and i need a way to call these from my asp page so the user can run them from the browser. Meaning i have a page with a list of all...
3
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from...
9
needhelp123
by: needhelp123 | last post by:
Can any one send me a quick sort simple logic pogram... its very urgent urgent
6
by: jenipriya | last post by:
Hi all... its very urgent.. please........i m a beginner in oracle.... Anyone please help me wit dese codes i hv tried... and correct the errors... The table structures i hav Employee (EmpID,...
1
by: psantosh12 | last post by:
Hello Frnds Please need help to resolve error.......... it is very very urgent........ The error is Runtime Error Description: An application error occurred on the server. The current custom...
1
by: =?Utf-8?B?Sm9yZ2UgUmliZWlybw==?= | last post by:
Hello I've a huge problema with a asp.net page. my page has a user control that fires an event in that event handler I load a control property and update some text boxes accordingly. my...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.