new to c++

Pages: 123
Hi. i am new to c++ i went with c++ over C because people said that it is a waste of time to learn c and what you are trying to doing is going to be using c++

so i have a compiler called code blocks vary simple and free, is this the best one to use?

i have only wrote 1 program, i have wrote hello world and then messed with it a bit,put notes so i have that down ,i get what c++ is, correct me if i am wrong but its like talking in computer language. not like 100101010 but more the way the programs talk to the computer...and or things like apps and emulators and just code so its a way to talk,am i right on that?

what website should i be using to learn c++ i started off here
http://www.cprogramming.com/tutorial/lesson1.html
i am done with the 1st two thing they showed me
is this a good place to learn c++ or should i use this site to learn or can any one just help me out with learning?...i see a lot of people saying code plz and can you do this for me and blah blah blah i am not asking for code or any of that bullshit i just want someone to point me the right way :)

and please tell me if i am doing anything wrong i really want to learn c++ the right way with no bad habits :)

sorry if my spelling is not the best...i went Through and i saw no errors
Is code blocks the best compiler (sic)? Is pepsi better then coke? While it's true that there are a great many IDE\compilers you should NOT use, there really isn't a functional difference between the options in the "approved list".

C++ isn't so much computer language but it uses a great deal more logic then any spoken language out there. It's more of a way for you to talk to the program and tell it how to talk to the computer or system to be a bit more accurate.

You should use this website to learn C++, people in the forums are very helpful and we really don't have a problem with trolls or elitists like on other sites.

Everyone who learns C++ has bad habits, you can work toward fixing them after you know what your code is doing.

Spelling isn't a problem here, for a large number of people posting questions English is their second language.

EDIT: Honestly I wish C++ WERE a way to talk to the computer, there are a few choice words I'd like to have with my system and it's been a long time coming...
Last edited on
Code::Blocks is a good IDE, check this article if you want to read a bit about other options: http://www.cplusplus.com/forum/articles/7263/
The tutorial on this very site are quite good and you may want to check those as well: http://www.cplusplus.com/doc/tutorial/
Another useful thing is the library reference, the one on this website is the best you can find: http://www.cplusplus.com/reference/
( It will come handy once you know a bit of the language )
The internet is the best place to learn something

C++ is a programming language, it isn't understood by a computer itself ( you need a compiler to turn it into something that the computer will understand ) but it's a tool that can make humans and computers talk a bit ;^)
ok awesome so use this site..mmk i have a question

so like most of all c++ programs start with

#include <iostream>
using namespace std;

int main ()

so that being said can i just put that each time?
I personally like this site. http://www.learncpp.com/. The teaching is different but very thorough. As far as bad habits, that I cannot vouch for because I am new to C++ as well. I have not used this site for its tutorials yet but I have heard from many sources that it is one of the better sources to learn from .

And yes, the people that ask for their code to be rewritten really shouldn't bother because they will never learn it the proper way. Coding is a path that is not mastered in a matter of weeks. More like years... I have a friend that has been writing C++ code since '97 and he still scours the internet for new ways of doing things. He is first to admit he doesn't know everything and likely never will. I have some work to do tonight but I will try to come back and find some of the links that I have found that I found particularly useful.
norgoshi wrote:
so like most of all c++ programs start with

1
2
3
4
#include <iostream>
using namespace std;

int main ()


so that being said can i just put that each time?
Yes, basic programs will always begin like that. You'll learn what you need once know a bit more of the language
Just in case you see it though so that you don't get freaked out Main is usually defined as:
 
int main(int argv, char* argv[])

It not terribly important that you know what these arguments do now, but you should know that main CAN take arguments even though it CAN NOT be called from within the program. If this doesn't make sense now don't worry about it, it's just something that I had some trouble understanding after I got into the language and I'm trying to save you that frustration.

Also if you see a code sample where main is defined like this:
 
void main()

Just know that the code is old so if anything you copy from it doesn't function like you would expect it's ok to move on.
Last edited on
hmm your right i have no cule what you just said but i have done this befor..... int main(void) i have no cule what that is but i used it 1

and can any one tell me what the main is ...its were there program starts right?
o wait...so main is like the command...like this

int main () { cout << " Hello World! "; cout << " I'm a C++ program "; return 0; }

and

#include <iostream>

using namespace std;

are what its getting the functions from ?
The main(...) function is the entry point for the program, it tells the compiler to start writing the program from here, no matter where you actually put main().

-#include is a command to the compiler to do something before it processes your code, in this case it tells it to read a file called "iostream" and act like everything that is written there is also written in your code. This way we avoid having to reinvent the wheel everytime we want to write a program.

-using namespace std; is hard to explain, a simple way of looking at it is that you are telling your compiler that you would wrote you code in shorthand following the rules set down in std.
Last edited on
o ok so main is the start......iostream is code that has been written by some one els but i am just saying hay use this code so really i could just right the code of iostream all out and it would work the same

and std is like a rule book mmk got it

if i have more question's i will ask
ok so i am on part 2 on this site http://www.cplusplus.com/doc/tutorial/variables/

so i look at all it had to say then it got to the part when i had to right the code....so i did i am sure its all right but i have some erros its telling my so i am going to post code and tell me if its right

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
//operating with variables

#include <iostream>
using namespace std;
int main ()

{
     //declaring variables:
     int a, b;
     int result;

     //proess:
     a = 5;
     b = 2;
     a = a + 1;
     result = a - b;

     //prints out the result:
     cout<<result;

     //teminate the program:
     return 0;
}




if you want the errors i can post them
Last edited on
the white space between return and 0 is required. return 0;
|3|error: iostream: No such file or directory|
|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before 'namespace'|
||In function 'main':|
|19|error: 'cout' undeclared (first use in this function)|
|19|error: (Each undeclared identifier is reported only once|
|19|error: for each function it appears in.)|
||=== Build finished: 5 errors, 0 warnings ===|

ok i fixed the return
nvm i fixed it idk but it will not let me have two files in the same project with out fucking up gay ok yay i fixed iot
There is also a popular book Thinking in C++ which is free. You can browse online or download or buy a hard copy if you want.
mmk i will look it up and its going good so far i am really geting it :)
Hi. i am new to c++ too. Really usefull post ... thanks to norgoshi to open it!
np they have really helped me so far really good stuff....mmk back to codeing that rpg iTs not going to make its self...jk i wish i was at that lv...SOON!!!!!!!!!!!!
odd question but can any one just like umm ask me a few questions on the first 2 parts of the Tutorial on this site like the parts i am done with are Structure of a program and Variables. Data Types. i just want to see how much of this i am retaining in my head and to see if i am geting it i am not going to cheat cus that would not help at all so any one just give me a few questions or a lot i don't care ty:)
Pages: 123