expected `,' or `;' before "int"

Hi I just started c++ a few days ago, and I'm making a distance converter. My code is:

#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

int main()
{


//KM
double km_km = 1;
double km_mm = 1000000;
double km_m = 1000;
double km_cm = 100000;

//CM
int cm_cm = 1;
double cm_km = 0.00001;
int cm_mm = 10;
double cm_m = 0.01;

//MM
int mm_mm = 1;
double mm_cm = 0.1;
double mm_m = 0.001;
double mm_km = 0.000001;

//M

int m_m = 1
int m_mm = 1000;
double m_km = 0.001;
int m_cm 100;
//Local Variables

string km ("km");
string cm ("cm");
string mm ("mm");
string m ("m");
double value;
string unit;
string converter;

//Code
cout << "Enter distance value: ";
cin >> value;
cout << "Enter unit: ";
cin >> unit;
cout << "Enter unit to convert to: ";



system("PAUSE");
return EXIT_SUCCESS;
}

The error I get is in line 31: main.cpp expected `,' or `;' before "int"
I have tried change all the ints to doubles but I just get this error:
Line 31 main.cpp expected `,' or `;' before "double"

I don't know what's wrong with this.
Any help is greatly appreciated!

Thanks
The error says it all. You are missing a ';', the "before int" signifies that before you declare another int, you need the ';':

1
2
3
4
int m_m = 1
int m_mm = 1000;
double m_km = 0.001;
int m_cm 100;


See it?

int m_m = 1//;
Last edited on
Topic archived. No new replies allowed.