Title: int and basic stuff
havick - June 20, 2003 11:23 PM (GMT)
what does the command int do?
and can someone explane some simple commands in c++
(i kinda know what cout && cin do but could someone explane it a little)
and how do u make a windows aplication(spelling?)
anyways im using bloodshed (anyone else use this one?)
Shadow of the Moon - June 20, 2003 11:41 PM (GMT)
int variablename;
declares a variable named variablename that can hold an integer value. On most systems an int takes 4 bytes, so 4 bytes of memory are allocated to hold it.
cout sends data to the output stream, so it prints text in a console app.
cin asks the user for input and assigns it to a variable.
As far as windows apps, you'll need to learn windows API and a number of other things, so you'll probably have to be patient.
ih8censorship - June 20, 2003 11:44 PM (GMT)
"int" means something returns an interger or any whole number and i know its used for variables and for int main() so main() must always return an interger but i could be wrong im not through the first chapter in my c++ book yet. i dont know much about making windows aplications exept you need to know about the windows api and you need to go like #include <windows.h> or somethin like that. which is why im sticking with console apps for now.
Shadow of the Moon - June 21, 2003 12:25 AM (GMT)
yeah a type name in front of a function is its return type.
Standard C++ Types
int - integer
float - real number
double - large real number
long - large integer
short - small integer(takes less memory)
unsigned (anyother) - only positive numbers
char - letter
bool - booleen value (either true or false)
<-EDIT->
Oops, I forgot bool, but some compilers don't handle it very well.
StarReaver2 - June 24, 2003 01:39 AM (GMT)
Int is one of the smaller forms of variables. there's also char, for letters, short, which is smaller than int, float, i think, carries 4 decimals, and double, i think, carries 8 decimal places. correct me on the long, i think i'm wrong. I too am a n00b at C++ :blink:
Well, this is my first post! i guess i can get help on a board now.
ih8censorship - June 24, 2003 02:01 AM (GMT)
double
default carries to the 8th decimal place. you can use setpresision(number of decimal places to go to) i think float is basicly the same im not sure
| CODE |
double var1,var2,var3; //pretty sure this is right
int main() { var1=1 var2=2
var3==var1/var2 setprecision(9) //pretty sure this isnt right but you something //simmilar if you want to go to 9 decimal places
cout<<var3<<setprecision(9) //could be this too..... i dunno its late lol return 0; }
|
well i think ill give my brain a rest now.
**edit** sorry the code looks bad... but it looked good in the window i was typing in oh well im too lazy to fix it :lol:
Shadow of the Moon - June 24, 2003 01:40 PM (GMT)
I think I may go type up another list on these. Maybe later.