What am i doing wrong?
Author |
Message |
changming22x
|
Posted: Fri Apr 03, 2009 11:31 pm Post subject: What am i doing wrong? |
|
|
hey i just started C++, like literally i jsut started 20 min ago lol, and umm i made this programe it gives the wrong output for the value calculated im not sure if the formula i used was wrong but it outputs a value followed by a "x" then some other value its confusing lol, would someone take their time and help me out? thanks
c++: | #include <iostream>
using namespace std;
int main()
{
int birth,cyear,byear,heartb,totalb,totalbb;
cout<<"Please enter your year of birth: \n ";
cin>>birth;
cin.ignore();
cout<<"Please enter the Current year: \n ";
cin>>cyear;
cin.ignore();
cout<<"Please enter the number of heart beats in 1 min: \n ";
cin>>heartb;
byear = cyear - birth;
totalb = byear * heartb;
totalbb = totalb *525600;
cout<<"The total number of heart beats since you were born: \n "<<totalbb<<
cin.ignore();
cin.get();
} |
Mod edit: Please use [ syntax = "cpp" ] [/ syntax ] tags . |
|
|
|
|
|
Sponsor Sponsor
|
|
|
rdrake
|
Posted: Sat Apr 04, 2009 1:21 am Post subject: RE:What am i doing wrong? |
|
|
Typo on this line:
c++: | cout<<"The total number of heart beats since you were born: \n "<<totalbb<< |
Remove the "<<" and put a ";" at the end.
c++: | cout<<"The total number of heart beats since you were born: \n "<<totalbb; |
|
|
|
|
|
|
changming22x
|
|
|
|
|
|
|