There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell display driver drivers email error excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware network networking nvidia outlook outlook 2003 outlook express partition printer problem ram router slow sound trojan usb video virus vista windows windows vista windows xp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
simple c++...


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
daveyp225's Avatar
Member with 86 posts.
 
Join Date: May 2003
08-Nov-2003, 08:44 PM #1
simple c++...
Hello, I'm working on a project for my C++ class..

I'm writing a program that performs various calculations that the user would want to perform, and at the end, ask if they want to perform another calculation.

The loop works great, but the second time around (if they decide to have another calculation) it seems to skip the part where it asks the user for input and uses the information from the previous calculation. The user input that it skips is:

cin >> num1 >> char1 >> num2 >> char2 >> num3 >> char3 >> num4;


Any suggestions on what I could be doing wrong?
daveyp225's Avatar
Member with 86 posts.
 
Join Date: May 2003
08-Nov-2003, 09:02 PM #2
SOLVED
I didn't reset the checksum boolean for the loop..
Stupid mistake on my part..

Thanks anyway!
daveyp225's Avatar
Member with 86 posts.
 
Join Date: May 2003
08-Nov-2003, 11:37 PM #3
another question..
I'm not too good with user-friendly directions.. and quite frankly, i lack good vocabulary skills...

I'm trying to tell someone to input two fractions and I will add/subtract/multiply/divide them...

For example they will input: 1/3 * 3/5.. and i will find the answer...
How would I go about telling them what to do and make sense at the same time.
The best I could come up with is "enter a fractional computation and this program will compute it"
lol.. i dont even think that makes sense..

anyone with good programming-like vocabulary wanna help?
AlbertB's Avatar
Distinguished Member with 2,432 posts.
 
Join Date: Nov 2002
Location: Hampshire, UK
09-Nov-2003, 08:23 AM #4
If I am correct I think you are inputting your data in the following format.

cin >> num1, fraction1 TOP >> char1, "/" >> num2, fraction1 BOTTOM >> char2, operator, ( + _ * / ) >> num3, fraction2, TOP >> char3, "/" >> num4, fraction2 BOTTOM;

Hope this is correct.

Professional looking but user friendly stuff is always best kept in simple but correct language. So just split it into small chunks and and say it how you mean.

Remember that you do not need all of the characters inputted in the right order. If you are inputting them individually into temporary variables you can have them offered in the most logical order from the users perspective and just do the concatenation, (joining), of the individual characters invisibly afterwards in whatever order you need.

Likewise you do not need the user to input the " / " characters, which I am assuming are your char1 and char3 variables. You already know what these should be.

So try something like:

Code:
cout << "You are asked to input the numbers making up 2 fractions," <<
        << endl << "and the mathematical action you wish me to perform with them."
        << endl << "Please enter the required character then <RETURN>"
        << endl << endl;

cin    >>  "Fraction 1, TOP, ( ?/- ) :  " >> num1
        >> "Fraction 1, BOTTOM, ( -/? ) :  " >> num2
        >> "Fraction 2, TOP, ( ?/- ) :  " >> num3
        >> "Fraction 2, BOTTOM, ( -/? ) :  " >> num4
        >> "Mathematical action to perform, (+ - * /):  " ;
This sort of approach should make it clear what you want and is flexible for your data manipulation afterwards.
__________________
1. "I make no personal claim to the truth, only the right to seek it, prove it in argument, and to be wrong many times in order to reach it."

2. "We have made a cage of words and placed our God inside, as boys trap a cricket, to make him sing for us alone."

Galileo Galilei
daveyp225's Avatar
Member with 86 posts.
 
Join Date: May 2003
09-Nov-2003, 10:27 AM #5
Thanks a lot, youve been a big help!
AlbertB's Avatar
Distinguished Member with 2,432 posts.
 
Join Date: Nov 2002
Location: Hampshire, UK
09-Nov-2003, 11:08 AM #6
You're very welcome Davey, nice to know it was useful.

Rest assured that as your problems get more complex there is always someone here who can and will help you.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 04:55 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.