 | |
06-05-2003, 05:31 PM
|
#1 (permalink)
| | Registered User
Join Date: Jan 2003 Location: Reno, NV
Posts: 108
| » 
C++ Help
I want to become a progammer. But i have no idea where to start, what to start with, where to get it and yada yada yada... Could someone please recommend me to some places?
|
| |
06-06-2003, 01:18 AM
|
#2 (permalink)
| | Registered User
Join Date: Oct 2001 Location: Bellevue, WA
Posts: 92
|
are you looking for a degree? or are you wanting to do this as some sort of hobby?
__________________
-Digital D.
|
| |
06-06-2003, 01:20 AM
|
#3 (permalink)
| | Banned
Join Date: Nov 2002 Location: Seattle, WA
Posts: 3,289
| PHP Code: C++ 4 n00b's
Abstract C++ Notes
Lesson 1 -
about :
Simple use of the output routine in C++, this is a simple "Hello world!" program.
The source code:
#include
using namespace std;
int main() {
cout return 0;
}
Lesson 2 -
about :
Saving a string in the local variable Array. This is how a string is stored in the C++ programming language. For example, if you wanted to store a string "My name" each character will be stored in an array element, This means that Array[0] = 'M'. The cout in routine is used with the routine cin, which is used for taking input from the console and saving it in variables.
The source code:
#include
using namespace std;
int main() {
char Array[10];
cin >> Array;
cout cout return 0;
}
Lesson 3 -
about :
Pointers are used to point to an address in memory, for example the address of variables. It is possible to dynamically allocate memory for specific data types. These can be structs, for example to accomplish a linked list, or other dynamic data structure. It has an example of using a pointer to pointer, and other important pointer configurations.
The source code:
#include
using namespace std;
/*
//pass some floats back and forth, calculate current.
float CalcCurrent(float *Voltage);
int main() {
float Voltage = 120;
float Current;
Current = CalcCurrent(&Voltage);
cout return 0;
}
float CalcCurrent(float *Voltage) {
float Resistance = 1500;
float Current = *Voltage / Resistance;
*Voltage = 600;
return Current;
}
*/
/*
//send a char array and recieve on from PrintName(string)
char PrintName(char *Name);
int main() {
char Name[50];
cin >> Name;
*Name = PrintName(Name);
cout return 0;
}
char PrintName(char *Name) {
return *Name;
}
*/
Lesson 4 -
about :
Structs a a way that the programmer can define a data type, in this case we have three integers that may be accessed. To access a variable inside a structure when using normal context (i.e.: not a pointer) access the variable with the . character for example Hudson.TimeEmp.Day, would would access the Day variable of the struct inside User.
The source code:
#include
using namespace std;
struct Date {
int Month, Day, Year;
};
struct User {
char Name[50], Job[50];
float Wages;
Date TimeEmp;
};
int main() {
User Hudson;
strcpy(Hudson.Name, "Hudson T. Clark");
strcpy(Hudson.Job, "Software Engineer");
Hudson.Wages = 50.5;
Hudson.TimeEmp.Month = 5;
Hudson.TimeEmp.Day = 21;
Hudson.TimeEmp.Year = 2003;
cout cout cout cout return 0;
}
Lesson 5 -
about :
This is a very primitive linked list the purpose of it is to dynamically allocate Node structs, and manage them with pointers. This means that the data doesn't actually have a variable, you access them directly threw the use of a "HeadNode" which will point to another node using the "NextNode" pointer (from a pointer variable inside). This list only has an add function for adding nodes to the list.
The source code:
#include
using namespace std;
struct Node {
int Id;
char Name[50];
Node *NextNode;
};
int main() {
Node *FirstNode;
FirstNode = new Node;
strcpy(FirstNode->Name, "Hudson Clark");
FirstNode->Id = 1;
FirstNode->NextNode = new Node;
strcpy(FirstNode->NextNode->Name, "Nark Clark");
FirstNode->NextNode->Id = 2;
FirstNode->NextNode->NextNode = NULL;
Node *Traverse;
Traverse = FirstNode;
while(Traverse != NULL) {
cout Id
Name Traverse = Traverse->NextNode;
}
return 0;
}
Lesson 6 -
about :
This is a complete linked list program, it will do the above and allow you to manipulate a linked list. You may add, delete, or query the list. The things that are used to accomplish this are pointers, keep in mind the only method that the nodes in the list are managed are threw the use of pointers. The specific pointer you work with is the "HeadNode" it will contain a pointer inside to the next node in the list. This means that each node has a pointer to the next node, thus the term "Linked List".
The source code:
#include
using namespace std;
struct Node {
public:
int Var;
Node *Next;
Node() { Next = NULL; };
};
int ListSize;
void DisplayMenu();
void AddNode(Node *LastNode);
void DeleteNode(Node **HeadNode);
Node * SearchList(int Var, Node *HeadNode);
void QueryList(Node *HeadNode);
int main() {
int MenuSelection;
Node *HeadNode;
HeadNode = new Node;
Node *LastNode;
LastNode = HeadNode;
while(1) {
DisplayMenu();
cin >> MenuSelection;
switch(MenuSelection) {
case 1:
AddNode(LastNode);
LastNode->Next = new Node;
LastNode = LastNode->Next;
break;
case 2:
DeleteNode(&HeadNode);
break;
case 3:
QueryList(HeadNode);
break;
case 4:
exit(0);
break;
default:
cout
break;
}
}
return 0;
}
void DisplayMenu() {
cout
}
void AddNode(Node *LastNode) {
cout int Var;
cin >> Var;
LastNode->Var = Var;
}
void DeleteNode(Node **HeadNode) {
cout int Var;
cin >> Var;
Node *DeleteNode;
DeleteNode = SearchList(Var, *HeadNode);
if(DeleteNode == NULL) {
cout
} else if (DeleteNode == *HeadNode) {
*HeadNode = DeleteNode->Next;
} else {
Node *PrevNode;
PrevNode = *HeadNode;
while(PrevNode->Next != DeleteNode) {
PrevNode = PrevNode->Next;
}
PrevNode->Next = DeleteNode->Next;
delete DeleteNode;
}
}
Node * SearchList(int Var, Node *HeadNode) {
while(1) {
if(HeadNode->Var == Var) {
return HeadNode;
} else if(HeadNode->Next == NULL) {
return NULL;
} else {
HeadNode = HeadNode->Next;
}
}
}
void QueryList(Node *HeadNode) {
system("cls");
while(HeadNode->Next != NULL) {
cout Var HeadNode = HeadNode->Next;
}
}
Lesson 7 -
about :
This is an example of a class, the class file has a set of routines inside to manipulate something, you can store data in the class as well. This creates a Box object, and allows the user to enter the height, width, depth to compute volume.
The source code:
#include
using namespace std;
int main() {
Box Thisisabox(6, 6, 6);
int volume;
volume = Thisisabox.volume();
cout return 0;
}
Additional class file:
#include
using namespace std;
class Box {
private:
int height, width, depth;
public:
Box(int, int, int);
~Box();
int volume();
};
Box::Box(int ht, int wd, int dp) {
height = ht;
width = wd;
depth = dp;
}
Box::~Box() {
}
int Box::volume() {
return height * width * depth;
}
Lesson 8 -
about :
This is another class that will create a clock object and allow the programmer to compute clicks, and check the current state of the timer.
The source code:
#include
#include
using namespace std;
int main() {
Clock MyClock(5);
cout MyClock.Click();
cout MyClock.Click();
cout MyClock.Click();
cout return 0;
}
Additional class file:
class Clock {
private:
int ClockPulse;
public:
Clock(int);
~Clock();
Click();
int ClickState();
};
Clock::Clock(int cp) {
ClockPulse = cp;
}
Clock::~Clock() {
}
Clock::Click() {
ClockPulse++;
}
Clock::ClickState() {
return ClockPulse;
}
Created by: Dark_Archon
Last edited by iNeb; 06-06-2003 at 01:25 AM.
|
| |
06-06-2003, 01:22 AM
|
#4 (permalink)
| | Registered User
Join Date: Jun 2002 Location: Iowa
Posts: 2,527
|
__________________
The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners. --- Author Unknown.
|
| |
06-06-2003, 01:22 AM
|
#5 (permalink)
| | Registered User
Join Date: Oct 2001 Location: TOO close to Wash DC
Posts: 7,956
|
VBulletin for n00b's
If you're gonna cut and paste a page w/o a link at least use the [ code ] tags so the stuff is organized
nobody can read that stuff
__________________
<< Insert exceedingly large and overly verbose message of how 1337 you are here including full specs of every vehicle you've ever driven and PC you've owned >>
|
| |
06-06-2003, 01:24 AM
|
#6 (permalink)
| | Banned
Join Date: Nov 2002 Location: Seattle, WA
Posts: 3,289
|
I didn't cut and paste it from a page, but rather from a user that posted that in one of my forums i admin.
I'll [code] it
|
| |
06-06-2003, 03:59 AM
|
#7 (permalink)
| | Registered User
Join Date: Apr 2002 Location: Georgia
Posts: 137
| Quote: Originally posted by vass0922 VBulletin for n00b's
If you're gonna cut and paste a page w/o a link at least use the [ code ] tags so the stuff is organized
nobody can read that stuff | Actually, I can read it, but it is quite annoying just the same
and to answer original person's question/response, I would suggest you learn the following in the following order if possible
1: any TI calculator programming language (requires that you own a programmable TI calculator though)
2: C
3: C++
4: Java
5: about now you should learn as much about DOS as you can
6: HTML (make SURE you learn about browser differences!)
7: JavaScript <-- This will be a toughie....also important to learn about browser differences!
8: now you should learn as much about UNIX/Linux as you possibly can (at least how to use the most common utilities)
9: Learn UNIX/Linux shell scripting and MS-DOS batch file programming if you haven't done so by now
10: Now learn how to program, using C, in Linux
11: Learn how to program MS-DOS based programs using x86 assembly language.
12: PHP
13: Perl
14: Now try to learn the Win16 API and how to program in Windows3.0/3.1
15: Now try to learn the Win32 API and how to program in Windows95+ (it builds on the Win16 API and some things quite frankly will make no sense unless you had a Win16 API background)
16: Now try to learn X Windows API. This is what UNIX/Linux uses for all graphical applications.
17: Learn Xt and Motif for UNIX/Linux
18: Learn how to program Windows programs in x86 assembly language.
19: Learn how to program Linux programs in x86 assembly language.
20: Learn any other assembly languages of your choice. The more the merrier.
21: Learn as many file formats as you possibly can
22: There's much more, but, I'm sure once you've gotten here, you will know what to do
__________________
Jüš† ä €öm¶ù†Ê® §ÇÌÈñŒ mÅjÒ®
|
| |
06-11-2003, 01:08 PM
|
#8 (permalink)
| | Registered User
Join Date: Jan 2003 Location: Reno, NV
Posts: 108
|
im looking to learn how to program as a career choice, but so far i have no idea as to what kind of things the programming help sites are talking about, so far everything i try and do turns out to be a wild goose chase! Anyone know where i can actually find the resources for these programming languages?
__________________
Truth Is Relevent, Facts are not.
|
| |
06-11-2003, 01:13 PM
|
#9 (permalink)
| | Registered User
Join Date: Jan 2003 Location: Reno, NV
Posts: 108
|
Oh yeah, and all i have to say about my last goose chase is that it has left me with a very sour disposition towards Xemacs. And i still dont know how to do jack. Oh and if that part about ti calcs was correct, then i could use some help finding resources because i have a 83+ and an 86, and am very interested in programming for these. If i could only find some help that is a bit more in depth than the instructors manual.
__________________
Truth Is Relevent, Facts are not.
|
| |
06-11-2003, 01:16 PM
|
#10 (permalink)
| | Registered User
Join Date: Oct 2002 Location: Scotland, UK
Posts: 2,946
|
If you can't program at all, and have no experience, I don't suggest starting with C++. 
Have a look at python. Its very easy, has loads of docs on the site and makes a great primer for going on to other things. www.python.org
If you want to go straight into C, then be my guest. The best advice I can give is to go out and buy a good book. You get much more out of that than you could from free internet tutorials.
I'd actually reccommend buying 2 books. 1. A small book like "C for begginers" or something, then a big thick book that will take you through it in more detail when you get the idea.
If you know someone who is willing to help in person, then that is a bonus as well. Plus there are loads of forums, I reccomend programmersheaven for lots of things, there is stacks of info there, but we're here as well.
__________________
_____
NuKeS
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions  | | | | | Recent Discussions  | | | | | |