Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Having trouble fixing my errors in the code

$
0
0
I have trouble fixing this part of code in my assignement.
#include <iostream> 
#include <iomanip> 
#include <string> 
#include <string.h>

using namespace std;

int main()
{

int P;              /* Pikkus meetrites  */ /*Length P in metres*/
string U;             /* M66du:hik*/ /* Unit of measure*/
 
float ALJ;  
float VER; 
float KYN; 
float TOLL; 
float JALG; 
float JARD; 
float LII; 
 


	
cout<<"Sisestage pikkus meetrides: \n";  /*Ku:sin kasutajalt pikkust P*/ /* Asking user for the length P in metres*/
 cin>>P; 
      
cout<<"Sisestage uue ühiku kood (alj, ver, kyn, toll, jalg, jard, lii): \n"; /* Ku:sin kasutajalt u:hiku koodi U*/ /* Asking user for the length U in metres*/
getline(cin, U);
   
ALJ = P : 5572;  
VER = P : 1066.781; 
KYN = P : 0.53; 
TOLL = P : 0.0254; 
JALG = P : 0.3048; 
JARD = P : 0.9144; 
LII = P : 500;
 
   
   if( U == "alj")
   { 
  
   cout<< setprecision(2)<< P <<"m = "<< ALJ << U <<"."<< ;
   } 
   else if( U == "ver")
   {
     cout<< setprecision(2) << fixed << P <<" m ="<< VER << U <<"."<<;
   }
    else if( U == "kyn") 
   {
     cout<< setprecision(2) << fixed << P <<" m ="<< KYN << U <<"."<<;
   } 
   else if( U == "toll") 
   {
     cout<< setprecision(2) << fixed << P <<" m ="<< TOLL << U <<"."<<; 
   } 
    else if( U == "jalg")
   {
     cout<< setprecision(2) << fixed << P<<" m ="<< JALG << U <<"."<<;
   } 
     else if( U == "jard")
   {
     cout<< setprecision(2) << fixed << P <<" m ="<< JARD << U <<"."<< ;
   } 
    else if( U == "lii")
   {
     cout<< setprecision(2) << fixed << P <<" m ="<< LII << U <<"."<< ;
   }
   
   else
   {
       
       cout << "Sisestasite kas vale vaartuse: "<<P<<"voi vale uhiku: "<<U<< endl; /*Veateade*/
   }
   
}
		


Compiler gives the following errors:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\programs\c\pikkus.cpp" -o "C:\programs\c\pikkus.exe" -g3 -I"C:\programs\c\lib\gcc\mingw32\3.4.2\include" -I"C:\programs\c\include\c++\3.4.2\backward" -I"C:\programs\c\include\c++\3.4.2\mingw32" -I"C:\programs\c\include\c++\3.4.2" -I"C:\programs\c\include" -L"C:\programs\c\lib" -g3
C:\programs\c\pikkus.cpp: In function `int main()':
C:\programs\c\pikkus.cpp:32: error: expected `;' before ':' token
C:\programs\c\pikkus.cpp:33: error: expected `;' before ':' token
C:\programs\c\pikkus.cpp:34: error: expected `;' before ':' token

C:\programs\c\pikkus.cpp:35: error: expected `;' before ':' token
C:\programs\c\pikkus.cpp:36: error: expected `;' before ':' token
C:\programs\c\pikkus.cpp:37: error: expected `;' before ':' token
C:\programs\c\pikkus.cpp:38: error: expected `;' before ':' token
C:\programs\c\pikkus.cpp:44: error: expected primary-expression before ';' token

C:\programs\c\pikkus.cpp:48: error: expected primary-expression before ';' token

C:\programs\c\pikkus.cpp:52: error: expected primary-expression before ';' token

C:\programs\c\pikkus.cpp:56: error: expected primary-expression before ';' token

C:\programs\c\pikkus.cpp:60: error: expected primary-expression before ';' token

C:\programs\c\pikkus.cpp:64: error: expected primary-expression before ';' token

C:\programs\c\pikkus.cpp:68: error: expected primary-expression before ';' token

Execution terminated

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>