First  Prev  1  2  3  4  5  Next  Last
Kondo's C++ class
Sensei
17753 cr points
Send Message: Send PM GB Post
25
Offline
Posted 8/7/08

Nyctophyll wrote:


otae_san wrote:


Nyctophyll wrote:


otae_san wrote:

hehehe... this is NOT a shoutout to anyone..

Lesson 1, Gintama-style:





How did you take this pic out of your computer? Its not from the camera right?


Hello Sakamoto-san! i have a program called SnagIt for doing screencaps. You can edit the image too.



Otae-san!! can you tell me how you got it? or did you bought it?


um.. Print Screen →Paste→Crop (thats pretty easy right?)
should be around ur scroll cap/break l pause..
Sensei
3193 cr points
Send Message: Send PM GB Post
25 / M
Offline
Posted 8/7/08 , edited 8/7/08

amisikun wrote:



I have made some questions to make sure you read my lessons carefully
1. Find and fix all the errors in this program. There are 7 mistakes if you fix it one way and 8 if you fix it another way

#include "stdafx.h"
#include <iostream>

user namespace std;

int main()
{
cout << "Hello World!"
char a;
cin >> a;
return 0;\

}



2.What is a header file?
a list of commands?? in other words a command prompt i believe

3. Why do the keywords cout and cin need header files?
to follow commands in an order or when accessed

4. What is the keyword cout used for?
a command that does what u you want it to on the screen

BONUS
5. Why do you think quotation marks are needed when using the cout keyword?
(hint words are not the only thing cout and output onto a screen)

um .. uses quotation marks so it outputs all letters & numerals (so numbers wont be mistaken for commands)

i hope i got close on these >_< it takes alot for me to get something so u'll just hav to deal sensei


Oh you got the bonus right
here are the corrections

so here's an explanation of the header file READ THIS header files are very important.
A header file is like a library (not quite but just think of it this way) it contains many little keywords like cout that the computer wouldn't know otherwise


So lets pretend you are making a research report on amino acids, you know somethings off the top of your head about what an amino acid is, but you still need to use things like books and websites, those books and websites are the header files. But you need a bibliography or your teacher (the compiler aka Visual Studio 2008 in your case) won't accept it
that is why we write #include <iostream>.

The extra information you are using are the keywords like cout and cin, but like the compiler we know somethings that do not need citations because they are in our heads, that is the case for some keywords like char. In some reports people write small numbers next to special words
to note where they are from or what they mean. In C++ we would write (the namespace like std)::(the function like cout), but if we want to skip that we put a special line that includes all of those keywords which is in this case using namespace std;. If you didn't understand this then I will explain it in another lesson.
Sensei
10136 cr points
Send Message: Send PM GB Post
24 / M / The Universe is a...
Offline
Posted 8/7/08 , edited 8/7/08

amisikun wrote:


um.. Print Screen →Paste→Crop (thats pretty easy right?)
should be around ur scroll cap/break l pause..


that was the button i was pressing HAHA!! idk why it wont work.
Sensei
17753 cr points
Send Message: Send PM GB Post
25
Offline
Posted 8/7/08 , edited 8/7/08

Nyctophyll wrote:


amisikun wrote:


um.. Print Screen →Paste→Crop (thats pretty easy right?)
should be around ur scroll cap/break l pause..


that was the button i was pressing HAHA!! idk why it wont work.


it did pull up MS paint , click on the the botton with an outline of a box...hit Ctrl+V (Ctrl & V at the same time).. & it should be there
Sensei
10136 cr points
Send Message: Send PM GB Post
24 / M / The Universe is a...
Offline
Posted 8/7/08
ok........forgot about that lol
Sensei
17753 cr points
Send Message: Send PM GB Post
25
Offline
Posted 8/7/08

fruitschinposamurai wrote:

so here's an explanation of the header file READ THIS header files are very important.
A header file is like a library (not quite but just think of it this way) it contains many little keywords like cout that the computer wouldn't know otherwise


So lets pretend you are making a research report on amino acids, you know somethings off the top of your head about what an amino acid is, but you still need to use things like books and websites, those books and websites are the header files. But you need a bibliography or your teacher (the compiler aka Visual Studio 2008 in your case) won't accept it
that is why we write #include <iostream>.

The extra information you are using are the keywords like cout and cin, but like the compiler we know somethings that do not need citations because they are in our heads, that is the case for some keywords like char. In some reports people write small numbers next to special words
to note where they are from or what they mean. In C++ we would write (the namespace like std)::(the function like cout), but if we want to skip that we put a special line that includes all of those keywords which is in this case using namespace std;. If you didn't understand this then I will explain it in another lesson.


the slash was by accident.. T_T im glad i got one right..& you were surprised -
*_* thanks..
Sensei
10136 cr points
Send Message: Send PM GB Post
24 / M / The Universe is a...
Offline
Posted 8/7/08

amisikun wrote:


Nyctophyll wrote:


amisikun wrote:


um.. Print Screen →Paste→Crop (thats pretty easy right?)
should be around ur scroll cap/break l pause..


that was the button i was pressing HAHA!! idk why it wont work.


it did pull up MS paint , click on the the botton with an outline of a box...hit Ctrl+V (Ctrl & V at the same time).. & it should be there




Thanks for telling me amisikun!! This phrase is for Musashi-san!! HAHA!!
Sensei
10136 cr points
Send Message: Send PM GB Post
24 / M / The Universe is a...
Offline
Posted 8/7/08
oi kondou san!! i finally memorized the code to do all that HAHA!!
Sensei
3193 cr points
Send Message: Send PM GB Post
25 / M
Offline
Posted 8/7/08 , edited 8/7/08

Nyctophyll wrote:

oi kondou san!! i finally memorized the code to do all that HAHA!!


Good job, but it would've been smarter to do that when you when you understand the program so you could do this from scratch. I am getting lesson 3 done as we speak
Sensei
10136 cr points
Send Message: Send PM GB Post
24 / M / The Universe is a...
Offline
Posted 8/7/08

fruitschinposamurai wrote:


Nyctophyll wrote:

oi kondou san!! i finally memorized the code to do all that HAHA!!


Good job, but it would've been smarter to do that when you when you understand the program so you could do this from scratch. I am getting lesson 3 done as we speak


awesome!! im waiting for it lol
Sensei
3193 cr points
Send Message: Send PM GB Post
25 / M
Offline
Posted 8/7/08 , edited 8/20/08
Lesson 3
Today we are going to learn about one type of variable: "the integer"
the integer can be any whole number negative or positive. But you cannot give them huge values
because if you do it will just give you the maximum amount it can hold instead of the number you want
this is how it is written
int (name of integer) = (value you want to put in it);
it could also be written like this
int (name of integer);
(name of integer) = (whatever value you want to put in it);

So lets say i want to make a integer type variable named q and I want to give it a value of 10
I would write it like this
int q = 10;

or
int q;
q = 10;

Like in algebra integers can equal other integers
so
int a = 2;
int b =a;

a would have a value of 2 and b would have a value of 2
There are some syntax you need to know though; you cannot make a integer whose name is a number so you can't name an integer 2.
There are ways to specify what kind of integer you are making, using these keywords before the int part
unsigned - if you want the integer to only have a positive value
long - if you are making the integer large
short - if you want to make the integer small
signed - if you want the integer to have a positive or negative value
So lets say you made a integer that represented health, we would make it unsigned and short because we don't want negative health, and we don't want the player to use a cheat for a huge amount of health

The bonus question of lesson 2 was talking about quotation marks being needed when using the cout function to output a string of characters onto the screen. Here is why the quotation marks are needed:

#include "stdafx.h"
#include <iostream>
using namespace std;

int main ()
{
int a;
a = 2;
cout << a;
char b;
cin >> b;
return 0;
}

This would put the number 2 onto the screen whereas

#include "stdafx.h"
#include <iostream>
using namespace std;

int main ()
{
int a;
a = 2;
cout << "a" << endl;
char b;
cin >> b;
return 0;
}

would output the variable a (2) onto the screen The endl is something that skips to the next line for the next input or output its useful if you want to make sure the numbers don't clump together because if you don't make a space or use the endl function the numbers would be put together with no space between
so pretend we wanted to put the numbers 10 and 2 on the screen, without using endl it would
look like this 102 instead of the two numbers separately.
I think that is a lot to digest. So I will stop there but i am going to put up an assignment
I want you to write a program that puts the numbers 1, 2, and 3 onto the screen and then on the final line I want it to say []bbye. Do not put up a picture of it write the code for it then post it up, make sure you debug it first, you do not need to hide it by spoilers if someone cheats its their loss, they won't learn anything, and since I'm not grading this it's pointless to cheat.
Sensei
10136 cr points
Send Message: Send PM GB Post
24 / M / The Universe is a...
Offline
Posted 8/7/08
#include "stdafx.h"
#include <iostream>
using namespace std;

int main ()
{
int a;
a = 2;
cout << "1" << endl;
cout << "2" << endl;
cout << "3" << endl;
cout << "[]bbye" << endl;
char b;
cin >> b;
return 0;
}





I'll post some pics if you want to lol
Sensei
3193 cr points
Send Message: Send PM GB Post
25 / M
Offline
Posted 8/7/08 , edited 8/7/08

Nyctophyll wrote:

#include "stdafx.h"
#include <iostream>
using namespace std;

int main ()
{
int a;
a = 2;
cout << "1" << endl;
cout << "2" << endl;
cout << "3" << endl;
cout << "[]bbye" << endl;
char b;
cin >> b;
return 0;
}


I'll post some pics if you want to lol

I wanted you guys to use variables for these values.
because instead of

cout << "1" << endl;
cout << "2" << endl;
cout << "3" << endl;

you could have wrote

int a = 1;
int b = 2;
int c = 3;
cout << a << endl;
cout << b << endl;
cout << c << endl;

because a variable is like a box in C++ when the computer sees the variable they only see its name and what is inside thats why the cout function sees a in this case as 1.so when dealing with larger numbers it makes it easier to write a instead of 10202. Do it again. You got it right, but you won't learn anything if you do it that way.

Sensei
10136 cr points
Send Message: Send PM GB Post
24 / M / The Universe is a...
Offline
Posted 8/7/08 , edited 8/7/08

fruitschinposamurai wrote:


Nyctophyll wrote:

#include "stdafx.h"
#include <iostream>
using namespace std;

int main ()
{
int a;
a = 2;
cout << "1" << endl;
cout << "2" << endl;
cout << "3" << endl;
cout << "[]bbye" << endl;
char b;
cin >> b;
return 0;
}


I'll post some pics if you want to lol

I wanted you guys to use variables for these values.
because instead of

cout << "1" << endl;
cout << "2" << endl;
cout << "3" << endl;

you could have wrote

int a = 1;
int b = 2;
int c = 3;
cout << a << endl;
cout << b << endl;
cout << c << endl;

because a variable is like a box in C++ when the computer sees the variable they only see its name and what is inside thats why the cout function sees a in this case as 1.so when dealing with larger numbers it makes it easier to write a instead of 10202. Do it again. You got it right, but you won't learn anything if you do it that way.







got it lol
Sensei
3193 cr points
Send Message: Send PM GB Post
25 / M
Offline
Posted 8/7/08

Nyctophyll wrote:

got it lol


then post your corrections.
First  Prev  1  2  3  4  5  Next  Last
You must be logged in to post.