Hello. I am new to coding. I just started and I am following a book called "C++ for Dummies" this book is basically a "How to" on coding. I typed exactly as the author did on converting Celsius to Fahrenheit and IT IS HARD!!!! I clicked on build program and it told me I had all of these errors. It said that there were both errors on my main.cpp and my Celsius to Fahrenheit code. Please tell me what I am doing wrong.
MAIN.CPP-
[/b]- #include <iostream>
using namespace std;
int main()
count << "Hello World!"<< endl;
return 0;
//
CELSIUS TO FAHRENHEIT-
#include <iostream>
using namespace std;
int main()
count << "Hello World!"<< endl;
return 0;
//
// Conversion- Program to convert temperature from
// Celsius degrees into Fahrenheit:
// Fahrenheit = Celsius * (212 - 32) / 100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main (int nNumberofArgs, char* [szArgs [])
[
// 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;
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 teminating program
// to allow the user to see the program results
cout << "Press Enter to continue..." << endl;
cin.ignore (10, '/n');
cin.get ();
return 0;
Thank you all very much for helping out me. I am just starting to learn code. Also, does anybody have any suggestions on where I should go to learn c++ more?
//
// Conversion- Program to convert temperature from
// Celsius degrees into Fahrenheit:
// Fahrenheit = Celsius * (212 - 32) / 100 + 32
//
#include <iostream>
int main()
{ // ****** <=
// enter the temperature in Celsius
int celsius;
std::cout << "Enter the temperature in Celsius:";
std::cin >> celsius;
// calculate conversion factor for Celsius
// to Fahrenheit
// int factor;
constint factor = 212 - 32;
// use conversion factor to convert Celsius
// into Fahrenheit;
constdouble fahrenheit = factor * celsius / 100.0 + 32;
// output the results (followed by a NewLine)
std::cout << "Fahrenheit value is:" << fahrenheit << '\n' ;
// wait until user is ready before teminating program
// to allow the user to see the program results
std::cout << "Press Enter to continue...\n" ; // << endl;
std::cin.ignore ( 10, /* '/n' */ '\n' );
std::cin.get ();
} // ************ <=
Thanks, but I copied and pasted yours. I still have 7 errors.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
//
// Conversion- Program to convert temperature from
//Celsius degrees into Fahrenheit:
//Fahrenheit = Celsius * (212 - 32) / 100 + 32
//
#include <iostream>
int main()
{ //} ****** <=
// enter the temperature in Celsius
int celsius;
std::cout << "Enter the temperature in Celsius:";
std:cin >> celsius;
// calculate conversion factor for celsius
// to Fahrenheit
// int factor;
const int factor= 212-32;
// use conversion factor to convert celsius
// into Fahrenheit;
const double fahrenheit = factor * celsius/100.0 +32;
// output the results (followed by a NewLine)
std:cout << "Fahrenheit value is:" <<fahrenheit << '/n'
// wait until user is ready before terminating program
// to allow the user to see the program results
std:court << "Press Enter to continue.../n" ; // << endl;
std:cin.ignore ( 10, /* '/n' */'/n' );
std:cin.get ();
} // ************ <=
By far the best C++ book I have ever read is Jumping into C++ by Alex Allain. The book requires zero previous programming skills and is very easy to read. Alex knows all of the pitfalls that beginners get themselves into and also how best to explain concepts. I have gone from zero programming skills to writing fairly complex programs in a matter of 3 months.
I am talking about running a code on Code:Blocks on a mac. I watched a Youtube video of a windows computer running code:blocks. They got a black screen with they hit build-run. On the mac; when I hit build-run I just got a text box that said press "enter" to continue. I did and I got nowhere. My question is, how do I get the program to actually run and not just sit there?
Try posting what you have now and please use code tags (<>).
In the mean time, you have several problems still with what you posted above.
1 2 3 4 5 6 7 8 9 10
// output the results (followed by a NewLine)
std:cout << "Fahrenheit value is:" <<fahrenheit << '/n' // One colon after std and missing ;
// wait until user is ready before terminating program
// to allow the user to see the program results
std:court << "Press Enter to continue.../n" ; // << endl; // One colon after std
std:cin.ignore ( 10, /* '/n' */'/n' ); // One colon after std
std:cin.get (); // One colon after std
// No return value
}