The following code fails to give me some output.
#include<iostream>
using namespace std;
int main()
{
»·······int choice;
»·······double km;
»·······double miles;
double MILES_PER-KM = 0.6214;
double KMS_PER_MILE = 1.6093;
»·······cout<<"\nMiles and Kilometers Converter\n";
»·······cout<<"................................\n";
»·······cout<<"1 : Miles to kilometers\n;
»·······cout<<"2 : Kilometers to miles\n;
»·······cout<<"3 :Quit\n\n;
»·······cout<<"Enter 1,2 or 3: ";<<endl;
»·······cin>>choice;
»·······if (choice == 1)·
»·······{
»·······»·······cout<<"Miles? ";
»·······»·······cin>>miles;
»·······»·······km = miles * KMS_PER_MILE ;
»·······»·······cout<<miles<<"miles = "<<km<< "kilometers\n";
»·······}
»·······else if (choice == 2)
»·······{
»·······»·······cout<<"Kilometers? ";
»·······»·······cin>>km;
»·······»·······miles = km * MILES_PER_KM;
»·······»·······cout<<km<< "kilometers = '<<miles << "miles\n;
»·······}
»·······else if (choice == 3)
»·······cout<< "Illegal choice!";
»·······return 0;
}
It gives out this error
> g++ mile.cpp
mile.cpp: In function `int main()':
mile.cpp:9: error: expected initializer before '-' token
mile.cpp:14: error: missing terminating " character
mile.cpp:15: error: missing terminating " character
mile.cpp:16: error: missing terminating " character
mile.cpp:17: error: expected primary-expression before '<<' token
mile.cpp:31: error: `MILES_PER_KM' was not declared in this scope
mile.cpp:32: error: expected `;' before "miles"
mile.cpp:32: error: stray '\' in program
can anyone please help with this....Please........ I am new to c++.
~