PDA

View Full Version : Need help with a script


ajsmith1104
1st October 2008, 18:32
for some reason I cannot figure out the next step. They want the script to add the 5 inputed decimals and convert them to the nearest integer and Im stuck any help is appreciated thanks. This is what I have so far.

#include <iostream>

using namespace std;
int main()
{
int var1;
int var2;
int var3;
int var4;
int var5;

cout << "Enter five numbers with decimals seperated by spaces. " <<
endl;
cin >> var1 >> var2 >> var3 >> var4 >> var5;



return 0;

}

burschik
2nd October 2008, 11:34
When do you have to hand in your homework?

nicephotog
24th November 2008, 19:37
..."to add the 5 inputed decimals"... did you mean to
commit addition of them then round it.
If add them then round to, Maybe the ints you have should be floats
and then the answer should be demoted by casting to an int.