Hi
I am creating a simple C++ program to ask user for fahrenheit in main thread and then convert this value to Celsius in another thread.
But i continue to get one error . This error keeps
visual studio 2008\projects\cs1\cs1\cs1.cpp(16) : error C2143: syntax error : missing ';' before '='
This problem sometimes disappears but instead of that a run time exception appears. I am using Visual studio 2008, windows XP.
thanks -Sunny Jain
#include "stdafx.h"
#include "stdafx.h"
#include "windows.h"
#include "stdlib.h"
#include "stdio.h"
#include "process.h"
#include "conio.h"
#include "iostream"
using namespace std;
bool flag= false;
void calculateTemperature_DegreeCelcius(void * Fahrenheit)
{
float far;
far=*((float*) Fahrenheit);
float celcius = (5.0/9.0)*(far - 32);
cout << "\nDegree Celcius :";
cout << celcius;
flag = true;
}
int _tmain(int argc, _TCHAR* argv[])
{
float temp_Fahrenheit;
while(true){
cout << "\nEnter Degree Fahrenheit value you want to convert to Degree Celcius\n";
cout << "Degree Fahrenheit :";
cin >> temp_Fahrenheit;
_beginthread(calculateTemperature_DegreeCelcius, 0, &temp_Fahrenheit);
while(true){
if(flag==false){
Sleep(200);
} else {
break;
}
}
char *command = (char *)NULL;
cout<< "\nDo you want to continue ? yes/no :";
cin>> command;
if (strcmp("yes",command)){
flag = false;
} else {
break;
}
}
return 0;
}