Hello,
I am trying to figure out this program on how to make it loop if Y is pressed and exit when N is pressed at the end of the program. The other problem I'm having is that this program can not have any decimals or negatives in it when the child enters the numbers. The last problem I'm having is that where the "Add _ together _ times and If I enter 2 2 it will give me 2+2+2+2=4 and the result will give me 2*2=4. The result part I have with out a problem...but its the expanding and taking down on the number of times the + signs shows up to give the answer to a child in simple form. The follow is the output for this program (below is the code I have so far):
(clear screen if Y is pressed to start over)
Welcome to the Multiplication Assistant
What is the 1st number? (example 2)<-- (I'm just showing what i'm getting right now for answers if I enter these numbers in)
what is the 2nd number? (example 2)<--
Add _(2) together _(2) times 2+2+2+2=4 <--(this is a problem...its not supppose to do that and I'm not sure how to fix or write it)
Result 2*2=4
Would you like to try again (Y/N)?
Can someone please help me out with this?
Thank you so much!!
ethompson
/*Multiplication Assistant*/
//Program Name: Program7.CPP
#include <iostream>
#include <string>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
using namespace std;
int main()
{
double mult; // multiplier
double multand; //multiplicand
double result; //result
char response; //response
cout<<"Welcome to the Multiplication Assistant";
cout<<endl<<endl;
cout<<"What is the 1st number? ";
cin>>multand;
cout<<"What is the 2nd number? ";
cin>>mult;
cout<<endl;
[B]result = multand * mult;
{if ((multand<=32767) && (mult<=32767));
cout<<"Add "<<multand<<" together "<<mult<<" times ";
cout<<multand<<" + "<<multand<<" + "<<multand<<" + "<<multand<<" = "<<result;
cout<<endl;[/B]
cout<<"Result ";
cout<<mult<<" * "<<multand<<" = "<<result;
cout<<endl<<endl;
[B]response =='Y' || 'N';
cout<<"Would you like to try another (Y/N)? ";
cin>>response;
cout<<endl;[/B]
system("CLS");
else if ((multand>32767)&&(mult>23767));
cout<<"The number you entered is to high, please try again"<<endl;
}
cin.get();
cin.get();
return 0;
}