Katzewurzt
12-09-2006, 12:18 PM
I'm learning C++ and I wrote this thingy here (nothing big:P), which is not working... I would like some experienced dudeling maybe, tell me what I did wrong.
I'm using Bloodshed's Dev-C++.
include <iostream.h>
using namespace std;
int main()
{
int multiply;
long int nrOne, nrTwo, nrThree;
long int addition = nrOne+nrTwo+nrThree;
cout<<"First enter one number to multiply three others.";
cin>>multiply;
cin.get();
cout<<"Now enter three numbers to be added, then multiplied by the first.";
cin>>nrOne>>nrTwo>>nrThree;
cin.get();
cout<<"This equals to "<<multiply*addition<<".";
cin.get();
}
I also tried
... cout<<"This equals to "<<multiply*nrOne+nrTwo+nrThree<<"."; ...
But then it would just multiply the first number and ignore the rest, so:
3 x 2 + 2 + 2 = 6 + 4 = 10 ... when it Should've been 3 x 2 + 2 + 2 = 18.
I'm using Bloodshed's Dev-C++.
include <iostream.h>
using namespace std;
int main()
{
int multiply;
long int nrOne, nrTwo, nrThree;
long int addition = nrOne+nrTwo+nrThree;
cout<<"First enter one number to multiply three others.";
cin>>multiply;
cin.get();
cout<<"Now enter three numbers to be added, then multiplied by the first.";
cin>>nrOne>>nrTwo>>nrThree;
cin.get();
cout<<"This equals to "<<multiply*addition<<".";
cin.get();
}
I also tried
... cout<<"This equals to "<<multiply*nrOne+nrTwo+nrThree<<"."; ...
But then it would just multiply the first number and ignore the rest, so:
3 x 2 + 2 + 2 = 6 + 4 = 10 ... when it Should've been 3 x 2 + 2 + 2 = 18.