Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 11-16-2001, 10:46 PM   #1
Member (6 bit)
 
Join Date: Aug 2001
Location: Australia
Posts: 56
Send a message via ICQ to poloktim
I try but can't get anywhere...

I've tried to learn C++ for a while, but always give up because I can't understand an important thing, If possible can anyone be able to recommend me to a FREE compiler and be able to help me with the theory behind it all. I can never understand and remember commands if I don't know the theory, or its obvious what they are.


Thanking you in advance...
Timothy Pollock
poloktim is offline   Reply With Quote
Old 11-16-2001, 11:56 PM   #2
Member (13 bit)
 
DrZaius's Avatar
 
Join Date: Jul 2000
Location: Fullerton, CA
Posts: 7,030
Hi Tim,

What IDE/compiler have you been using so far? Sometimes starting out with notepad and command line compilers can be confusing. Have you used Dec-C++?

I havn't programmed any C++ in almost year (doing all Java now, very close to C++), but I'll try to answer any questions, so just feel free to ask.
__________________
"A witty saying proves nothing." - Voltaire
DrZaius is offline   Reply With Quote
Old 11-18-2001, 12:17 AM   #3
Member (6 bit)
 
Join Date: Aug 2001
Location: Australia
Posts: 56
Send a message via ICQ to poloktim
Thanks, but if anyone knows where any tutorials are, could they post it. Also I dont understand variables...

IF THEN and all those, I really dont understand.
Could you help me to understand them please.

Thanx again Timothy Pollock,
poloktim is offline   Reply With Quote
Old 11-18-2001, 12:43 AM   #4
Member (13 bit)
 
DrZaius's Avatar
 
Join Date: Jul 2000
Location: Fullerton, CA
Posts: 7,030
Hi Tim,

http://www.cprogramming.com/tutorial.html

There are a long list of tutorials that should help. It starts out with the basics and moves on. Regarding the specific questions:

Variables

It's very simple. A variable (or var) is just a way to store "information." For example,
Code:
int num = 5;
int This means that the type of variable will be an integer, or int. Similarly, you can make a string, character (one letter, or char), and many other things.

num This is the name of the varible, you can name it whatever you like as long as it's one word (no spaces) and it's not a pre-defined C++ word like int.

= 5 This gives the variable a specific value. You do not need to give it a value right away when you create the variable. You can just say
Code:
int num;
Which will allocate space in you memory for a variable. You can give a value to it later on by saying
Code:
num = 5;
if/else statements

if statements are exactly how they sound: if someting is true, then do something else. Some languages use then to specify what to do, but C++ already assumes that you want something else to happen. For example:
Code:
if (a == 1)
  cout << "foo"; // only does this if the condition (a == 1) is true
else
  cout << "bar";
The basic structure is if (something), where the value something between the parenthesis must be a true or false statement. So look at the statement, a == 1 (does a equal 1?), and if it does, then move on and cout "foo." Since the first statement was false, you move on to the next command which is else, and you cout "bar." The following code would have the same result.
Code:
if (a == 1)
  cout << "foo"; // only does this if the condition (a == 1) is true

cout << "bar";
Just read the code out loud ("If a equals one, print foo. Else print bar.") and it makes sense.

Always remember:
Code:
a = 1; // assigns the value 1 to the variable a
a == 1; // tells you if a is equal to one, either true or false
Hope that helps, and feel free to ask any other questions.
DrZaius is offline   Reply With Quote
Old 11-18-2001, 01:16 AM   #5
Member (6 bit)
 
Join Date: Aug 2001
Location: Australia
Posts: 56
Send a message via ICQ to poloktim
foobar???
Doesn't foobar mean
Fooed Beyond All Recognition... I find this programming to be a tad bit vulgar, but nuffing i can do about it. JAFO is what i am isn't it?
poloktim is offline   Reply With Quote
Old 11-18-2001, 01:33 AM   #6
Member (13 bit)
 
DrZaius's Avatar
 
Join Date: Jul 2000
Location: Fullerton, CA
Posts: 7,030
LOL

"foo" and "bar" have become common programming terms for dummy variables. Take any programming class the the teacher will use the word.
DrZaius is offline   Reply With Quote
Old 11-18-2001, 11:42 AM   #7
Member (10 bit)
 
Join Date: Mar 1999
Location: Random
Posts: 997
The best thing to do to learn programming is to find someone that knows it and constantly bug them until they teach you. Most of those C++ for idiots books are okay, but programming requires a different frame of mind, especially after you move past procedural C and into object oriented C++ and Java. These books just cannot compare to a live person who can tell you what is wrong with your program.

Deitel and Deitel's C++ How to Program is one of the favorites, but to tell you the truth, I always use those kinds of books as a reference, not to learn from scratch. Explaining concepts is always best done by a person.

Respectfully,

Demosthenes
Demosthenes is offline   Reply With Quote
Old 11-19-2001, 01:02 AM   #8
Member (6 bit)
 
Join Date: Aug 2001
Location: Australia
Posts: 56
Send a message via ICQ to poloktim
Unhappy

My small prob is... I don't know neone who knows any programming languages. :-( I live in an FUBAR area. I liked looking at and working out Boolean algebra... I thought that was fun (for maths).
poloktim is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:42 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2