Mistakes in code

closed account (oh04GNh0)
I need to find the mistakes in this code, but I can't work it out and would very appreciate some help.

don't mind weird letters :)

#include <iostream>
using namespace std;
double ziogas(double g)
{
double c;
c=g/3,6*100;
return c;
}
int main ()
{
setlocale (LC_ALL, "Lithuanian");
double g,c;
cout<<"Įveskite žiogo greitį km/h: ";
cin>>g;
c=ziogas(g);
cout<<"--------------------------------"<<endl;
cout<<"Žiogas nušoka "<<c<<" cm per sekundę"<<endl;
system ("pause");
return 0;
}
Last edited on
Firstly, sorry for my english
Secondly would you mind telling me, why are you so lazy? Debbuger tells you what the problem is. I just made account here and read regulations; don't make other homework, if possible hint only. I recognise youre programm as homework(sorry if I'm wrong). So here comes a hint: there is something missing in #include part
Decimal numbers in C++ use "." to separate the integer and fraction part, not ",". In other words, it's 3.14, not 3,14. So I think you mean c=g/3.6*100 instead of c=g/3,6 * 100.

Unfortunately the latter is legal C++ syntax and is basically the same as:
1
2
c = g/3;
6 * 100;  // compute 6*100 and throw away the result. 
Last edited on
Topic archived. No new replies allowed.