Ask your own question, for FREE!
Computer Science 15 Online
OpenStudy (adunb8):

can anyone help me im trying to multiply 3 x 5 but i get a star (*) this kind of shape for answer anyone know what is going on? first time c++ #include #include #include using namespace std; int main() { string product ; float a= 3.0, b= 5.0, c = 7.1, d=8.3, e=2.2, f=3.2 , g= 6.1; int h=5 ; cout << " " << a << endl; cout <<"*" << b << endl; cout << "-------------" << endl; product = 3.0*5.0 ; cout << product << endl; system ("pause") ; }

OpenStudy (walters):

#include <iostream> #include <string> #include<iomanip> using namespace std; int main() { float product ;//your type must b type float float a= 3.0, b= 5.0, c = 7.1, d=8.3, e=2.2, f=3.2 , g= 6.1; int h=5 ;//wat is the use of c,d,e,f,g,h cout << " " << a <<endl; cout<< "* "<<b<<endl; cout << "-------------" << endl; product = 3.0*5.0 ; cout << product << endl; system ("pause") ; }

OpenStudy (adunb8):

omg thank you !!! you saved my life!!!!!

OpenStudy (adunb8):

i kept writing it on the string but what i should of done is write it on float i see!!

OpenStudy (walters):

because ur type was string and u r multiplying the float it means u must change the type of the product or use cast function

OpenStudy (adunb8):

yea thanks!!!!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!