I am trying to learn C++ programming, and am trying to follow along with C++ For Dummies 5th ed. Unfortunately I've encountered a problem with the first project I copied the code exactly like it is in the book, but for some reason the program spits out the same number (-858993460) regardless of what input I give it (supposed to convert temperatures). I am using Microsoft Visual C++ 6.0 to write and compile my code. Any thoughts on this would be greatly appreciated! This is the code I have now:
Code:// // Prograam to convert temperature from Celsius // degree units to Fahrenheit degree units: // Fehrenheit - Celsius * (212 - 32)/100 + 32 // #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; int main(int nNumberofArgs, char* pszArgs[]) { // enter the temperature in Celsius int celsius; cout << "Enter the temperature in Celsius;"; cin >> celsius; // calculate conversion factor for Celsius // to Fahrenheit int factor; factor - 212 - 32; //use conversion factor to convert Celsius //into Fahrenheit Values int fahrenheit; fahrenheit - factor * celsius/100 + 32; //output the results (followed by a NewLine) cout << "Fahrenheit value is;"; cout << fahrenheit << endl; //wait until user is ready before terminating //program to allow the user to see the //program results system("PAUSE"); return 0; }