FSnC Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
February 12, 2012, 12:22:40 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
[Don Kalypso] 2:55 pm: Good-bye, Inc. It is with a heavy heart that I take my leave of you.
[Forte] 2:56 pm: It's been a fun game, Kaly.
[Don Kalypso] 2:56 pm: Go to Hell, Forte
Search:
Advanced search
Forte's Sprites n' Comics
FSnC Forum
Normal People Things
General Notspam
C++ Tutorial Topic R2
Pages: [
1
]
2
Go Down
« previous
next »
Author
Topic: C++ Tutorial Topic R2 (Read 793 times)
0 Members and 1 Guest are viewing this topic.
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
C++ Tutorial Topic R2
«
on:
October 24, 2008, 07:10:04 AM »
Once again, I'll be hosting a nice C++ Tutorial here. This time, I'm almost done with my C++ classes, instead of just starting off. I generally know what I'm doing, and should be able to help well.
For starters, go to
www.microsoft.com/express/
and download the Visual C++ Express Edition IDE. It's needed to turn the programs from source to executable. It'll take you a while. When that's done, I'll come back and give you the first lesson in every language: the "Hello World" project.
«
Last Edit: October 25, 2008, 11:24:12 PM by Death Dark
»
Logged
Quote from: lern
Quote
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #1 on:
October 25, 2008, 11:23:41 PM »
It suddenly came to my attention that there are more important things to start off with than a pure jumping into the code. So, instead of "Hello World," I shall do the following.
=====Introduction=====
What is C++?
C++ is a high-level object oriented computer programming language. It's a very powerful tool that is used to create many computer programs and applications. C++ came about as an extension of the C programming language and was initially called "C with Classes." Later, it became more modified and distinct, and was named C++. The convention would have been to name it C+, but that name was already taken by another, unrelated language.
A high-level language is one that is between sentient language (english, french, etc.), and machine language (binary, hexadecimal, etc). We can't talk to the computer in english, because it doesn't understand it. Instead, we use a standardized language that gets translated by compilers, linkers, etc. to machine language, and into a program. (The IDE in the first post has all of these built in, so don't worry about them)
An object oriented language is something harder to explain. Put simply, it's what made C++ distinct from C, and is a very powerful tool. When/If we get that far, I'll explain it later.
Why C++?
Apparently, there are other languages out there, so why should you use C++? For one thing, C++ was the first to have objects, and most languages that use them, are based off of it. In fact, many languages, such as PHP, JavaScript, Java, and C#, are strongly based off of C++. So, why not learn those instead? Well, if you're looking for something easy, then go with them. They'll baby you, and hold your hand, and make sure you don't hurt yourself. However, if you want a language with raw power and potential (you can make operating systems in C++, but not in Java), go with C++. It's also a good idea to learn C++ as learning it will give you knowledge enough to learn the other languages easily.
What do I need to get started?
Well, really, all you need is a compiler. Visual C++ is perfectly fine. I know, it's Microsoft, but there are still things that they do right. Visual C++ Express is completely free, though you'll need to register after 30 days. After that, all you need is to learn the language, and that's where I/this topic come(s) in. Don't worry, I'm fluent in C++.
Logged
Quote from: lern
Quote
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #2 on:
October 26, 2008, 12:08:52 AM »
=====Lesson 1: "Hello World"=====
Let's jump right in. After you have your IDE installed, go to File > New > Project. Choose General from the side bar, and Empty Project from the bigger part. At the bottom, name your project Hello World, and hit OK. To the side, in the Solution Explorer, right-click on the Source Files folder, and Choose Add > New Item... On the side bar, either choose Visual C++, or Code, and select C++ File (.cpp). Name it something like "Hello World Source," and hit OK.
If the file didn't open in the main window, double click it in the solution explorer. Before you should be a blank page. From there, copy/paste this (I'll explain it later):
Code:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World";
return 0;
}
Now, from the top menu, select Build > Build Solution (or hit F7). Down at the bottom, you should see some stuff running along. If you get any errors, then something went wrong somewhere, and you should PM me about it. If it compiled properly, choose Debug > Start Without Debugging (or hit Ctrl+F5). A console window should pop up and look something like
Quote
Hello WorldPress any key to continue...
I know, not pretty. However, you'll soon be able to fix that. For now, let's look at the code:
===Line 1: #include <iostream>===
This line is what's called a preprocessor directive. The # sign gets picked up by part of the IDE, and it does special things for you. This particular statement, called an includes statement, will include code from C++ Libraries (which contain helpful code), or other files that you wrote yourself. This one in particular is a library, denoted by the angled brackets <> around the library name.
===Line 2: using namespace std;===
This line is important if you intend to use the library. It's part of the includes statement, and tells the IDE to include all things in that library from the standard (std) namespace. Namespaces themselves aren't important, and may not be covered here, but make sure you use that. Make sure that the semicolon ; is there. It acts as a period does in english, to stop the sentence or line.
===Line 4: int main()===
This is what's called a function definition. However, this is a special function. Later, I'll explain user defined functions in greater detail, but for now, this is how this one's set up. The function main() (functions denoted by the parentheses) is the most important function in a program, as it's what runs when the program runs. Essentially, everything that your program does is in here, or is initiated from here. The int, the return type, is generally int, though void can be used (don't use it now, we'll cover that later). No semicolon is used at a function definition.
===Lines 5 and 9: { and }===
Braces, or curly brackets or birdie brackets, are used to denote blocks of code. You'll see them quite often from now on. They enclose portions of code, denoting that the code within goes with the marking at the beginning. In this case, it's the function definition. Generally, code that's contained within braces is indented to make it easier to see that it's contained within something. The Visual C++ IDE will do this automatically most of the time, but you should make sure that it's done, so that the code is easier to read for you and others.
===Line 6: cout << "Hello World";===
This is the only thing really happening in this program. cout, or console out, is the main method of output that we'll use for a very long time. In order to use it, we need the iostream (input/output stream) library. The cout takes care of all of the messy stuff needed to output text to the screen.
The << is called the extraction operator. Operators are symbols that denote certain actions that should happen. For example, + and - are mathematical operators. The extraction operator pulls out information and passes it to whatever is on the left-hand side of it. Since this is cout, the information passed to it gets displayed onscreen.
"Hello World" is contained within quotes. In the IDE, it should be color-coded to be dark red. This is what's known as a "String Literal," as everything in it gets displayed literally on the screen. Double quotes must be used to contain the literal. Single quotes can be used for a single character, but not strings. Make sure you put the ending quote on it, or else you'll get a "new line in constant" error.
The semicolon is needed for most lines of code, including this one.
===Line 8: return 0;===
As I said, main() has a return type of int. Therefore, we need to return a value. This value is given to the Operating System, and can mean different things. A return value of 0 denotes that everything went fine, and that the program closed correctly. I don't suggest feeding other values to it. Just return 0, and everything works out right. Trust me.
===A few quick notes on String Literals===
For now, you can still do a few things with string literals. Most characters, except \, ', and ", are accepted. To output multiple string literals, put a << in between them. To have some more fun, use some of these "escape sequences." They are initiated by the \ character, and can be used for formatting and the like.
\n - New Line - this inserts a line break into the string at any given time
\\ - Backslash - since \ is the escape sequence, putting two is how you get one to display
\' - Apostrophe - since a normal apostrophe will break the string literal, this allows you to display one normally
\" - Quote - same case as the apostrophe
\t - Tab - Inserts a tab into the code. Tabs are generally 5 characters or half-an-inch long
\a - Alert - Makes your computer beep.
As a last note, the console window generally can only fit 80 characters on one line. It has an automatic wrap, but it goes by letter, so it may break some in half. Also, the display is in a monospace font, so your code should match its spacing.
===For Next Time===
Play with some string literals, and next time, we'll talk about variables. They're funner than their math counterparts.
«
Last Edit: January 22, 2009, 01:01:00 AM by Death Dark
»
Logged
Quote from: lern
Quote
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #3 on:
October 30, 2008, 07:03:59 AM »
Mini-Lessons: Where I teach you things that are good to know, but aren't necessary for programming. They aren't to be ignored, but they aren't something to be too worried about.
=====Mini-Lesson 1: Comments=====
One very very very important part of C++ is comments. Comments are snippets english stuck in your code in such a way that the compiler ignores it, and it helps others explain what you do. You should comment as much as possible in your code, though I may not in my examples (because they're examples).
There are two ways to comment: end-line comments and block comments.
End-line comments are started by typing // into your code. Anything from that point to the end of the line will be ignored (hence the name). These are best used for commenting on one to a few lines of code.
Block comments must be enclosed between a starting /* and an ending */. All code between is ignored, no matter how many lines there are between the beginning and end. Block comments should be used to explain algorithms, functions, and generally what your program is doing.
===Spare Uses for Comments===
Comments have one side benefit to their use: you can block off code. If you're trying to figure out something that's not working, you can set that segment of code inside of a comment (// its line, or /* the beginning and */ the end) to get the compiler to ignore it. This is helpful for identifying bugs and helps you more than anyone else.
=====Lesson 2: Variables=====
Variables are how we store data and values in C++. If we want to keep something for any given length of time, and perhaps change it, we need to use variables.
There are a few types of variables in C++:
short: stores whole numbers from -32768 -> 32767; takes up 2 bytes of memory
int: stores whole numbers from -2
15
-> 2
15
- 1; takes up 4 bytes of memory
long: stores the same amount as an int; takes up 4 bytes of memory
float: stores decimals with 7 digits of accuracy (.0000001) ; takes up 4 bytes of memory
double: stores decimals with 16 digits of accuracy, and larger numbers than float; takes up 8 bytes of memory
long double: generally same as double; some systems use 10-12 bytes of storage, in which case long double far exceeds double
char: stores a single character; takes 1 byte of memory
bool: stores a boolean value (true/false); takes .5-1 bytes of memory
The key to the different data types is knowing the situation to use them in. For very large numbers, Double should be used. However, if you know you'll never go beyond the number 10, use short. The key is not to use the largest possible for everything, but to only use what you need. This makes for smaller, faster, more efficient programs.
===Using Variables===
To use a variable, first you have to declare it. To declare a variable, you need to give the type and the name (for naming rules, see Mini-Lesson 2).
Code:
int x;
Like most lines of code, use your semicolon. What this statement does is creates a variable in memory (RAM) to store information. In this case, it's an integer that we've named x. Well, what can we do with x? By using the assignment operator (=), we can assign values to x.
Code:
x = 4;
Now, the spot in memory assigned to x holds the number +4 (the sign is stored). Well, that's cool and all, but what else can we do with a variable? Well, the following mean quite a bit.
===Mathematical Operators===
Mathematical operators can be applied to any of the six numeric types of variables.
x + y: the Addition Operator
x - y: the Subtraction Operator
x * y: the Multiplication Operator
x / y: the Division Operator
x % y: the Modular Division Operator: this operator gives you the remainder of dividing the two numbers, for example 2 % 2 will give 0 because there is no remainder
-x: the Negative Operator
+x: the Positive Operator
Each of these can be applied to both variables and numbers given, and can be stored in variables:
Code:
int x;
x = 2 + 2; //x is now equal to 4
int y;
y = x * 4; //y is now equal to 16
Using things like this, we can do things such as the following:
Code:
double C;
double r;
double pi;
pi = 3.14;
r = 20;
C = 2 * pi * r;
===Working With Variables===
In using C++, you'll need to get very used to variables. As such, there are a few tricks that will make things easier.
=Initialization=
Initializing a variable is giving it a value as you declare it. To do so, give the type, name, the assignment operator, and a value.
Code:
int x = 4;
=Multiple Declarations=
You can string together variables of the same type in one declaration. To do so, declare the type, give a name, place a comma and a space, give the next name, and repeat as needed.
Code:
double C, r, pi;
=Multiple Initializations=
To initialize variables in multiple declarations, use the assignment operator on each one.
Code:
double C = 0, r = 20, pi = 3.14;
To make it easier to read, it's best to use a new line for each variable.
Code:
double C = 0,
r = 20,
pi = 3.14;
As a rule of thumb, set all variables equal to some dummy value when you declare them. This keeps you from accessing the data that was stored in memory before your variable got there.
=Conversion=
Most of the default types have an automatic conversion. If you set a double equal to an int, you'll get the full number stored in the double. However, if you set an int to a double, it will truncate. Truncation literally means to chop off. In these terms, the decimal is dropped, and the whole number part is stored in the int. This also counts if you do something like
Code:
double x = 2 / 5;
The result should be 2.5, but x is set to 2. Even though x can store 2.5, it was not the result of the math. This is one of the problems known as "integer division." It can easily be solved by doing something like this:
Code:
double x = 2.0 / 5;
When the computer is doing math for you, it automatically takes in numbers as ints. However, if you give a decimal point, it will convert everything to decimal. As a rule of thumb, all parts of a mathematical equation are converted to the highest power for calculation. If you go back and look at the 6 numeric types, they're given in their proper order.
=Using the Variable Itself=
The way that the assignment operator works is right-to-left. Otherwise, it handles everything on the right first, and then sets the variable to it. This allows you to do things like
Code:
num = num * 2;
To alter a number and store it back where it was, and
Code:
num1 = num2 = num3 = num4 = 0;
To assign the same number to multiple variables.
=Shortcut Operators=
There are a few operators that are shortcuts for others. For example, this
Code:
num = num * 2;
Can be written as this
Code:
num *= 2;
The +=, -=, *=, and /= operators are assignment operators combined with mathematical operators. By using them, you cause the variable on the left to be added/subtracted/etc. to whatever's on the other side.
Another quick pair are the increment and decrement operators. They add or subtract 1 from the variable. They can be used in any of the following forms:
Code:
num++;
++num;
num--;
--num;
The two different forms are called "postfix" and "prefix." The difference between the two is simple: one happens before something's done to the variable, one happens afterwards. For example this
Code:
int x, y;
y = 1;
x = y++;
Would result in x being 1 and y being 2. However, this
Code:
int x, y;
y = 1;
x = ++y;
Would result in both variables being equal to 2.
=Order of Operations=
The Order of Operations is different in C++ than math. The operators in C++ do have a priority order (which acts first), but they still aren't how they work in math. I'd explain it all, but if my memory serves me correctly, there are 15 different levels for order of operations in C++, and even more operators. Put simply, use parentheses to make sure things go as planned. Parentheses override all normal order, and provide you with an assured way to make sure things happen right. A good example of this is the increment operator we just discussed:
Code:
int x, y;
y = 1;
x = (y++);
This would force the postfix increment operator to act and then the assignment operator, unlike how it would've done otherwise.
===For Next Time===
Take a while to get used to variables and how they work. Next lesson will be more about variables, but we'll get into boolean, characters, and some other stuff we can do with them.
«
Last Edit: December 30, 2008, 04:44:37 AM by Death Dark
»
Logged
Quote from: lern
Quote
Sepuku.exe
Enforcer Unit
Dr. Wily
Hats: 12
Offline
Awards:
Wii Number: 6456888389533404
Brawl Code: 4468-0674-4193
Xbox Live Gamertag: Chcarraway
3DS Code: 3179-6082-8169
Steam ID: chcarraway
Posts: 1798
1625.00 DP
View Inventory
Send Money to Sepuku.exe
I have a secret button :D
Re: C++ Tutorial Topic R2
«
Reply #4 on:
January 16, 2009, 05:13:51 AM »
Sepuku's Note
I'm currently taking the introductory class, so I'll make notes every now and then that may help cover things that DD may miss or overlook.
Quote from: Death Dark on October 30, 2008, 07:03:59 AM
=====Lesson 2: Variables=====
Variables are how we store data and values in C++. If we want to keep something for any given length of time, and perhaps change it, we need to use variables.
There are a few types of variables in C++:
short: stores whole numbers from -32768 -> 32767; takes up 2 bytes of memory
int: stores whole numbers from -2
15
-> 2
15
- 1; takes up 4 bytes of memory
long: stores the same amount as an int; takes up 4 bytes of memory
float: stores decimals with 7 digits of accuracy (.0000001) ; takes up 4 bytes of memory
double: stores decimals with 16 digits of accuracy, and larger numbers than float; takes up 8 bytes of memory
long double: generally same as double; some systems use 10-12 bytes of storage, in which case long double far exceeds double
char: stores a single character; takes 1 byte of memory
bool: stores a boolean value (true/false); takes .5-1 bytes of memory
The key to the different data types is knowing the situation to use them in. For very large numbers, Double should be used. However, if you know you'll never go beyond the number 10, use short. The key is not to use the largest possible for everything, but to only use what you need. This makes for smaller, faster, more efficient programs.
A note on memory
The RAM is known as Primary Memory, the CPU gets its information directly from this. Stuff that is not being used at the moment is stored in Secondary Memory, Hard Disk Drives, Flash Drives, CDs, Floppy Discs, etc. Memory is divided into Bytes. A Byte is divided into 8 Bits. A Bit is short for Binary Digit, and stores either a 0 or a 1. Up until recently, Processors have only been able to manage 32 bits at a time, but now there are 64 bit processors, which can handle twice as much information than their predecessors.
«
Last Edit: January 16, 2009, 05:16:00 AM by Sepuku.exe
»
Logged
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #5 on:
January 22, 2009, 01:11:36 AM »
=====Mini-Lesson 2: Naming=====
Throughout C++, there are many things you can name, whether it be a function, a variable, a class, an object, a structure, or anything else that you may come across (I don't expect you to know what all of those are). For all of these, the same naming rules are in place:
1) A name can include only A-Z, a-z, 0-9, and the underscore "_" character.
2) A name cannot begin with a number.
3) A name cannot be reused within scope. (Will explain later, for now, don't reuse a name)
4) A name cannot be a keyword. Keywords appear in blue in your IDE. If you see a blue word, don't use it.
That's pretty much it. There are a few other things to take note of, though. The standard naming convention is for all lower case with a capital letter to signify a new word (if necessary).
Code:
int thatNumber;
The alternative is to use an underscore instead of a space, and have everything lowercase.
Code:
int that_number;
Try to follow one of these, as everything has its own convention (a commonly used habit shared by most of a community; kind of like a standard, but not as important) and therefore may confuse others who read your code. Remember:
Quote
Always write your code as if the person who will be maintaining it is a homicidal maniac who knows where you live.
Logged
Quote from: lern
Quote
Sepuku.exe
Enforcer Unit
Dr. Wily
Hats: 12
Offline
Awards:
Wii Number: 6456888389533404
Brawl Code: 4468-0674-4193
Xbox Live Gamertag: Chcarraway
3DS Code: 3179-6082-8169
Steam ID: chcarraway
Posts: 1798
1625.00 DP
View Inventory
Send Money to Sepuku.exe
I have a secret button :D
Re: C++ Tutorial Topic R2
«
Reply #6 on:
March 26, 2009, 08:36:59 PM »
I'M A PUTTIN UP MY DD SIGNAL!!
I need help. I have no clue how to do the second part of the Input Validation.
And no complaining about my format/technique. You're notorious for doing that.
Bark bark bark can't use stuff he hasn't taught yet bark bark bark.
Code:
/*
Starting Time Of Call Rate Per Minute
00:00 - 06:59 $0.12
07:00 - 19:00
0.55
19:01 - 23:59 0.35
Write a program that asks for the starting time and the number of minutes of the call, and displays the charges. The program should ask for the time to be entered as a floating-point number in the form HH.MM.
Input Validation - The program should not accept times that are greater than 23:59. also, no number whose last two digits are greater than 59 should be accepted. Hint: Assuming num is a floating-point variable, the following expression will give you its fractional part:
num - static_cast<int>(num)
*/
Code:
// Page 241 # 19
// March 25 2009
// Corey Carraway
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
float callstart, calltime, callcost;
// Time of Call
cout << "\nPlease use the following format for all times in this program:";
cout << "\nHH.MM\n";
cout << "\nWhat is the starting time of your call?\n";
cin >> callstart;
// Input Call Length
if (callstart >= 0 && callstart <= 23.59)
{
cout << "\nHow long was your call?\n";
cin >> calltime;
// Calculate Cost
if (calltime >= 0)
{
if (callstart >= 00.00 && calltime <= 06.59)
callcost = calltime * .12;
else if (callstart >= 7.00 && calltime <= 19.00)
callcost = calltime * .55;
else if (callstart >= 19.01 && callstart <= 23.59)
callcost = calltime * .35;
cout << "\nThe price of your call was $" << fixed << setprecision(2) << callcost << ".\n";
}
// Input Validation
else
{
cout << "\nThat is not a valid response\n";
return 0;
}
}
// Input validation
else
{
cout << "\nThat is not a valid response\n";
return 0;
}
return 0;
}
Logged
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #7 on:
March 26, 2009, 10:38:59 PM »
I'm not sure what you mean by "the second part," but here's two ways to do input validation:
Code:
cout << "Please give input: "; //or whatever
cin >> input;
while(input != correct) //change this as needed
{
cout << "Incorrect input. Input should be blah blah\n"
<< "Please give input: "; //again, change as needed
cin >> input;
}
The way I do it:
Code:
do
{
cout << "Please give input (constraints of input): ";
cin >> input;
if(input != correct)
{
cout << "\nDOING IT WRONG\n"
<< "Input must be blah blah.\n\n";
}
}while(input != correct);
Logged
Quote from: lern
Quote
Sepuku.exe
Enforcer Unit
Dr. Wily
Hats: 12
Offline
Awards:
Wii Number: 6456888389533404
Brawl Code: 4468-0674-4193
Xbox Live Gamertag: Chcarraway
3DS Code: 3179-6082-8169
Steam ID: chcarraway
Posts: 1798
1625.00 DP
View Inventory
Send Money to Sepuku.exe
I have a secret button :D
Re: C++ Tutorial Topic R2
«
Reply #8 on:
March 26, 2009, 11:14:28 PM »
Quote
also, no number whose last two digits are greater than 59 should be accepted. Hint: Assuming num is a floating-point variable, the following expression will give you its fractional part:
num - static_cast<int>(num)
How would this be done?
Logged
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #9 on:
March 26, 2009, 11:20:06 PM »
Code:
//given that earlier num was set to our time:
short min= (num - static_cast<int>(num)) * 10;
if(min > 59)
{
//cout errors
//etc.
}
Logged
Quote from: lern
Quote
Forte
Sing a melody of love
Pig Mask Private
Hats: 7780
Offline
Awards:
Brawl Code: 3952 6695 9657
Pokemon HG/SS Code: 0560 8974 2658
3DS Code: 0087 2304 6914
Steam ID: /FSnC\ Lento
Posts: 4109
15665.00 DP
View Inventory
Send Money to Forte
Give 'em the 4th-D Slip.
Re: C++ Tutorial Topic R2
«
Reply #10 on:
April 25, 2009, 10:17:09 AM »
Mine refuses <iostream>. Whyyyy.
Logged
[Today at 06:01:07 PM] Forte: But I'm pretty sure that nothing of value has been gained from this.
[Today at 06:02:20 PM] MegaRock35: Not to you, I guess, but this is the one place on the Internet I can call home.
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #11 on:
April 27, 2009, 05:57:37 AM »
did you do the whole
#include <iostream>
using namespace std;
?
If you leave out just one of those things, you'll not get a result.
Also, check for misspellings.
Logged
Quote from: lern
Quote
Forte
Sing a melody of love
Pig Mask Private
Hats: 7780
Offline
Awards:
Brawl Code: 3952 6695 9657
Pokemon HG/SS Code: 0560 8974 2658
3DS Code: 0087 2304 6914
Steam ID: /FSnC\ Lento
Posts: 4109
15665.00 DP
View Inventory
Send Money to Forte
Give 'em the 4th-D Slip.
Re: C++ Tutorial Topic R2
«
Reply #12 on:
April 27, 2009, 06:22:18 AM »
I did everything right, it just keeps complaining about using another header file, I can't even think of the name, but it ends with .h. Maybe I started up the wrong kind of file.
Logged
[Today at 06:01:07 PM] Forte: But I'm pretty sure that nothing of value has been gained from this.
[Today at 06:02:20 PM] MegaRock35: Not to you, I guess, but this is the one place on the Internet I can call home.
Death Dark
Abaddon
Pig Mask Commander
Hats: 2
Offline
Awards:
Xbox Live Gamertag: The Death Dark
Steam ID: Darksteel_Colossus
Posts: 5941
13390.00 DP
View Inventory
Send Money to Death Dark
Master of the Unfinished.
Re: C++ Tutorial Topic R2
«
Reply #13 on:
April 27, 2009, 08:01:46 AM »
.h is the appropriate extension for a C++ header file, to the point where the old notation would've been <iostream.h>
Can you post a copy of the error message?
Logged
Quote from: lern
Quote
Forte
Sing a melody of love
Pig Mask Private
Hats: 7780
Offline
Awards:
Brawl Code: 3952 6695 9657
Pokemon HG/SS Code: 0560 8974 2658
3DS Code: 0087 2304 6914
Steam ID: /FSnC\ Lento
Posts: 4109
15665.00 DP
View Inventory
Send Money to Forte
Give 'em the 4th-D Slip.
Re: C++ Tutorial Topic R2
«
Reply #14 on:
April 27, 2009, 08:24:58 AM »
Never mind. I did something wrong and opened the wrong kind of project file to begin with. It works fine now.
Logged
[Today at 06:01:07 PM] Forte: But I'm pretty sure that nothing of value has been gained from this.
[Today at 06:02:20 PM] MegaRock35: Not to you, I guess, but this is the one place on the Internet I can call home.
Pages: [
1
]
2
Go Up
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Issues of National Importance
-----------------------------
=> Site Announcements
=> Forum Announcements
-----------------------------
Normal People Things
-----------------------------
=> General Notspam
=> Technical Support
=> Badge Based Posting Simulator
=> Introductions
-----------------------------
Role Playing is Pretty Much as Descriptive as This Category Will Get
-----------------------------
=> General Role Play
-----------------------------
Vidya Gaems
-----------------------------
=> Nintendo
===> Brawl+
===> Nintendo WFC
===> Animal Crossing: City Folk
===> Pokemon
=> Microsoft
=> Sony
===> PSP
=> Everything else
===> Map Development
-----------------------------
Artsy People's Arts n' Crafts
-----------------------------
=> Sprites
===> Sprite Comics
=> Backgrounds
=> Artwork
===> Sigs and Avatars
=> Requests
=> Stories/FanFics
=> Coding
=> Fan Games
-----------------------------
He's changing the board names again, isn't he.
-----------------------------
=> Movies
=> Music
=> TV
-----------------------------
What About the Website?
-----------------------------
=> Site Discussion
=> Advertise and Affiliate
Our affiliates
Loading...