HELP PLEASE I am new.

closed account (E6Uk92yv)
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?

Thanks again!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// 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 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 ();
} // ************ <= 


Consider learning from another book.

See the 'Beginner Introductory' section in:
http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
closed account (E6Uk92yv)
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 ();
} // ************ <=
You cannot have two main()s. Get rid of this part:
1
2
3
4
5
6
7
8
9
#include <iostream>

using namespace std;

int main()
{
cout << "Hello world!" << endl;
return 0;
}
closed account (E6Uk92yv)
I did that. I deleted the main. It said I had no errors. There was a white box that pooped up with this message.

Last login: Thu Nov 6 17:43:31 on ttys000
Susan-Harrimans-MacBook-Pro-2:~ dukeofsapphire$ /Users/dukeofsapphire/Desktop/C++/CodeBlocks-2.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/dukeofsapphire/Desktop/C++/Xcode Codes/MyFirstProject/bin/Debug/MyFirstProject
sh: /Users/dukeofsapphire/Desktop/C++/Xcode: Permission denied

Process returned 126 (0x7E) execution time : 0.055 s
Press ENTER to continue.



Why is the permission denied? When I press enter it does nothing.

I am brand new to c++ and I am on a mac.


Get rid of the C++ For Dummies book.

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.

You can thank me later.
closed account (E6Uk92yv)
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
}

Topic archived. No new replies allowed.