learning C++
Moderators: Public Relations Department, Players Department
- fishfin
- Posts: 490
- Joined: Mon Mar 20, 2006 12:38 pm
- Location: Nanning, China
learning C++
I've already downloaded a file that is suposed to help me do C++ on windows but after that I got stuck. Is there anyone who knows C++ who could give me some advice on how to start off? (I've tryed some of those online guides but when I coppy and past what they have this thing about compiling comes up and then after I do that I click run and nothing happens.)
The following statement is not true.
The previous statement is not true.
The previous statement is not true.
- fishfin
- Posts: 490
- Joined: Mon Mar 20, 2006 12:38 pm
- Location: Nanning, China
I just tryed a guide that explained what comiling is, this one is the best one I've found so far http://www.cprogramming.com/tutorial/lesson1.html.
The following statement is not true.
The previous statement is not true.
The previous statement is not true.
- KVZ
- Players Dept. Member
- Posts: 5309
- Joined: Sun Sep 28, 2003 7:04 am
- Location: Vlotryan
- Contact:
Good luck
C++ is somewhat complicated language. Tried even some basic (Visual for example) first? Well, I will at one day start to learn assembly language of Intel x86 family 


Corruption born inside. I'm part of dark side / A.F.K. / We'll steal your dreams and control your minds
https://twitter.com/DukeKVZ / http://www.futurerp.net/pages/link.php?id=24880
https://twitter.com/DukeKVZ / http://www.futurerp.net/pages/link.php?id=24880
-
- Posts: 208
- Joined: Tue Mar 14, 2006 9:02 am
- N-Aldwitch
- Posts: 1771
- Joined: Thu Mar 16, 2006 1:48 am
- Contact:
Re: learning C++
fishfin wrote:I've already downloaded a file that is suposed to help me do C++ on windows but after that I got stuck. Is there anyone who knows C++ who could give me some advice on how to start off? (I've tryed some of those online guides but when I coppy and past what they have this thing about compiling comes up and then after I do that I click run and nothing happens.)
I'll be very happy to help you.
Two things though.
1) Have you programmed in anything else before, besides HTML?
2) Post the code here and I'll debug it for you.

Nakranoth's "evil" character says:
"Thief! That's terrible! *shakes his head* That would hurt people's feeling if I did that."
http://www.sylorn.com - Free MMORPG in development.. need help.
"Thief! That's terrible! *shakes his head* That would hurt people's feeling if I did that."
http://www.sylorn.com - Free MMORPG in development.. need help.
- N-Aldwitch
- Posts: 1771
- Joined: Thu Mar 16, 2006 1:48 am
- Contact:
Alright,
On the website it suggests to write this:
However my suggestion for this would be:
And with comments about commenting things out and an extra line and /n
Hope this helps.
On the website it suggests to write this:
#include <iostream>
using namespace std;
int main()
{
cout<<"HEY, you, I'm alive! Oh, and Hello World!\n";
cin.get();
}
However my suggestion for this would be:
Code: Select all
#include <iostream>
int main()
{
std::cout << "Hello world!";
return 0;
}
And with comments about commenting things out and an extra line and /n
Code: Select all
#include <iostream>
int main()
{
/* this is a c-style comment
and it extends until the closing
star-slash comment mark */
std::cout << "Hello world!\n";
// this C++ -style comment ends at the end of the line
std::cout << "That comment ended!";
// double slash comments can be alone on a line
/* as can slash-star comments */
return 0;
}
Hope this helps.
Nakranoth's "evil" character says:
"Thief! That's terrible! *shakes his head* That would hurt people's feeling if I did that."
http://www.sylorn.com - Free MMORPG in development.. need help.
"Thief! That's terrible! *shakes his head* That would hurt people's feeling if I did that."
http://www.sylorn.com - Free MMORPG in development.. need help.
- fishfin
- Posts: 490
- Joined: Mon Mar 20, 2006 12:38 pm
- Location: Nanning, China
I'm using this compiler:
http://www.download.com/3001-2069_4-10498828.html
and the only other programing language that I know is (limited) html.
http://www.download.com/3001-2069_4-10498828.html
and the only other programing language that I know is (limited) html.
The following statement is not true.
The previous statement is not true.
The previous statement is not true.
- Pie
- Posts: 3256
- Joined: Sun Jun 19, 2005 3:30 am
- Location: the headquarters of P.I.E.
-
- Posts: 208
- Joined: Tue Mar 14, 2006 9:02 am
- N-Aldwitch
- Posts: 1771
- Joined: Thu Mar 16, 2006 1:48 am
- Contact:
Gender wrote:So, how is it going anyway? Did you manage to run this piece of code?
What he said... Because in some cases, your compiler may be out of date or no good.
Can I suggest Borland?
In particular, C++BuilderX is a great program released by Borland..

Nakranoth's "evil" character says:
"Thief! That's terrible! *shakes his head* That would hurt people's feeling if I did that."
http://www.sylorn.com - Free MMORPG in development.. need help.
"Thief! That's terrible! *shakes his head* That would hurt people's feeling if I did that."
http://www.sylorn.com - Free MMORPG in development.. need help.
- SekoETC
- Posts: 15525
- Joined: Wed May 05, 2004 11:07 am
- Location: Finland
- Contact:
I read my first tutorial in Finnish...
You could use
if it isn't supposed to return anything.
And
makes a query sort of a thing. But char type variables were really hard at first so needs to use only numbers for queries. Since if you put the wrong type of data into a variable, for example char to int, it crashes (or more likely creates an endless loop). Also the variables need to be listed in the beginning like int a, b, c=1; and so on.
Later I learned a thing that records keypresses, after that you can use also letter commands and arrow keys.
It's been a while since I've touched Borland...
Oh and if you see nothing, that's most likely because the program runs itself and closes, because you didn't include a break there.
You could use
Code: Select all
void main()
{
//Something here
}
if it isn't supposed to return anything.
And
Code: Select all
cin >> variable_name;
makes a query sort of a thing. But char type variables were really hard at first so needs to use only numbers for queries. Since if you put the wrong type of data into a variable, for example char to int, it crashes (or more likely creates an endless loop). Also the variables need to be listed in the beginning like int a, b, c=1; and so on.
Later I learned a thing that records keypresses, after that you can use also letter commands and arrow keys.
It's been a while since I've touched Borland...
Oh and if you see nothing, that's most likely because the program runs itself and closes, because you didn't include a break there.
Not-so-sad panda
-
- Posts: 208
- Joined: Tue Mar 14, 2006 9:02 am
- fishfin
- Posts: 490
- Joined: Mon Mar 20, 2006 12:38 pm
- Location: Nanning, China
the code given by the website worked but the code you gave didn't, C++Builder is no longer availible for download (acording to a Google search)
and what did someone say up there about recording the keys pressed? How do you do that?
and what did someone say up there about recording the keys pressed? How do you do that?
The following statement is not true.
The previous statement is not true.
The previous statement is not true.
-
- Posts: 208
- Joined: Tue Mar 14, 2006 9:02 am
To pause the program execution you can for example wait for user to press a key on the keyboard.
Something like: "press any key to continue..."
If you don't include any statement, that will stop your program for a while, it will blink on your screen for a second, and you will not be able to read the results.
You can pause your program by several different ways, for example:
cin >> x; // where x is some variable
This instruction will stop your program until the user enters a number or string and hits enter.
there are various functions (get(), getch() or getchar()) which will stop your program. These functions will not wait for user to press enter. You can find description of them in manual for your compiler.
Something like: "press any key to continue..."
If you don't include any statement, that will stop your program for a while, it will blink on your screen for a second, and you will not be able to read the results.
You can pause your program by several different ways, for example:
cin >> x; // where x is some variable
This instruction will stop your program until the user enters a number or string and hits enter.
there are various functions (get(), getch() or getchar()) which will stop your program. These functions will not wait for user to press enter. You can find description of them in manual for your compiler.
- SekoETC
- Posts: 15525
- Joined: Wed May 05, 2004 11:07 am
- Location: Finland
- Contact:
Return to “Non-Cantr-Related Discussion”
Who is online
Users browsing this forum: No registered users and 1 guest