I got this working in Codeblocks, but I only recently figured out how to start up MS Visual express 2010. How would I get this conversion program to work?
// F2C Fahrenheit to Celsius
#include<iostream>
#include<assert.h>
usingnamespace std;
int main()
{
char input;// input for f or c
int num;// the furture input for the value to convert from
while ((input >=-273) && (input !='q') && (input !='Q'))//loops program
{
cout << "Enter what you wish to convert from Celsius or Fahernheit[C/F]: ";
cin >> input;//get the c or f
cout << "You Entered: " << input ;
if(input == 'c' || input == 'C')// if the input is c
//convert c to f
{
cout << "\nEnter C: ";
cin >> num;// get the c
cout << "\nThe Fahrenheit is: "<< num*1.8 +32 << endl;//output the f
}
elseif(input == 'f' || input == 'F')
{
//convert f to c
cout << "\nEnter F: ";
cin >> num;//get the f
cout << "\nThe Celsius is: "<< (num-32) /1.8 << endl;//output the c
}
elseif(input =='q' || input =='Q')//ends program
break;
else
{
//the value was not c or f so give error
cout << "\nYou didn't enter c or f" << endl;
}
}
return 0;
}
Both CB and VS are IDE, integrated development environments. That is mostly GUI and not really language dependent. Each has to be told differently, which source files belong to "a project". Project defines which files to compile and with what options, when you press a "Compile" button.
Under the hood each has a C++ compiler, which they call to compile C++ sources into binary. The only reason for the compilation to fail with different compiler is when the source uses features that are not supported by the second compiler.