Jump to content

Welcome to 1Emulation.com
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

C class is opening.

- - - - -

  • Please log in to reply
23 replies to this topic

#1
someboddy

someboddy

    Sergeant Moderator

  • Ultra Members
  • 1,657 posts
  • Gender:Male
  • Location:The Israeli Army
Click to view battle stats
You alweys wanted to learn C & C++, this is your chance!!!
to download C++, go to this page:http://someboddy0.tr...domain/id7.html

#2
someboddy

someboddy

    Sergeant Moderator

  • Ultra Members
  • 1,657 posts
  • Gender:Male
  • Location:The Israeli Army
Click to view battle stats
type this program:

#include <stdio.h>

void main(){
printf("Hello world, this is my firs C program");
}


and press Ctrl+F9.
the program started, but it was to fast. to see the rezolts, press Alt+F5.

now is the explain to the program:

#include <stdio.h>
this part is loading the file "stdio.h", that olds the basic functions of C.

void main(){
this part opens the program main code, from that code the program starts.

printf("Hello world, this is my firs C program");
this part order the program to show on the screen the text: "Hello world, this is my firs C program".
the ";" say the program that the "printf" command is finished.

}
this part say the program that the main code is ended.

#3
someboddy

someboddy

    Sergeant Moderator

  • Ultra Members
  • 1,657 posts
  • Gender:Male
  • Location:The Israeli Army
Click to view battle stats
Any questions?

#4
someboddy

someboddy

    Sergeant Moderator

  • Ultra Members
  • 1,657 posts
  • Gender:Male
  • Location:The Israeli Army
Click to view battle stats
If you dont post here replys, I will think you dont what to learn how to make games, and stop teaching you!!!

#5
DreamCastLover

DreamCastLover

    ĐR€ĹMÇŧT ]v[ŘD

  • Premium Members
  • 891 posts
Click to view battle stats
I think it's probably that people don't want to fill up your thread with junk posts. You are doing a great job and I know plenty people want to learn C++.

#6
TapeWurm

TapeWurm

    Member

  • Members
  • 84 posts
  • Location:Northern CA
  • Interests:80's nostalgia, movies.. big time, old school cartoons, retro-gaming, newsgroups, file sharing, writing, computers for 20+ years, good applications and trying to stay close to God, despite being a constant sinner.
Click to view battle stats
Even with great software to use, I gave up mu hopes of programming a long time ago. I just wanted to make applications.... just didn't have the time to learn though. :D

#7
alexis

alexis

    Argentina Football Ownz

  • Ultra Members
  • 1,735 posts
  • Location:Somewhere in time
Click to view battle stats
Give me sometime, ok? i just came back from a short vacations so i´m getting slightly up to date and very annoyed for the actions of an ASSHOLE. Anyway as i was saying give me sometime

#8
someboddy

someboddy

    Sergeant Moderator

  • Ultra Members
  • 1,657 posts
  • Gender:Male
  • Location:The Israeli Army
Click to view battle stats
This is a program that adding two numbers:

#include <stdio.h>

void main(){
int a,b,c;
printf("ngive me 2 numbers ");
scanf("%d,%d",&a,&:D;
c=a+b;
printf("%d+%d=%d",a,b,c);
}


now is the explain to the program:

#include <stdio.h>
this part is loading the file "stdio.h", that olds the basic functions of C.

void main(){
this part opens the program main code, from that code the program starts.


int a,b,c;
this command is making 3 variables from an integer type: a, b & c.


printf("ngive me 2 numbers ");
this part order the program to show on the screen the text: "give me 2 numbers ". the "n" in the beginning of the text tells the program to nove one row down.

scanf("%d,%d",&a,&:D;
this command is a litle complicated.
the function 'scanf', is a function that can get data from the user.
inside the brackets, there are 3 parameters:
[list]

[*]"%d,%d": this string tells the program that she want the user to give her a integer (%d), than a ',' sign(,), than a another integer. for example: "4,7" and then press enter.
you can put anything you want instend of the ','. if you put there space, the program just wait that the user prees enter.

[*]&a: this is the integer that the program will put in it the first number (for the first "%d").

[*]%b: this is the integer that the program will put in it the second number (for the second "%d").

[list]

c=a+b;
this command put a value in to the variable "c". the value is a+b.

printf("%d+%d=%d",a,b,c);
this command is putting a text on the screan. the "%d" signs tells the program that there are going to be integers after the string. this time you don't need to put '&' before the variable, because this function doesn't cange the variables, it just using thair values.

}
this part close the main code.

#9
someboddy

someboddy

    Sergeant Moderator

  • Ultra Members
  • 1,657 posts
  • Gender:Male
  • Location:The Israeli Army
Click to view battle stats
type this program:

#include <stdio.h>

void main(){
int i,x,sum;
sum=0;
printf("nngive me 10 numbersn");
for (i=0;i<10;i++){
scanf("%d",&x);
sum=sum+x;
}
printf("nI puted all your numbers togeder, and got %d",sum);
}


and now I will explain:

#include <stdio.h>
this part is loading the file "stdio.h", that olds the basic functions of C.

void main(){
this part opens the program main code, from that code the program starts.


int i,x,sum;
this command is making 3 variables from an integer type: i,x & sum.

sum=0;
this command sets the veriable sum to zero. it mean reseting it.

printf("nngive me 10 numbersn");
this part order the program to show on the screen the text: "give me 10 numbers". the "n"s in the text tells the program to move one row down.

for (i=0;i<10;i++){
this part thells the program to start a 'for' loop. inside the brackets, there are 3 parts, secluded by ";" sign (this is the same sign that secludind commands.

[list]

[*]the first one is a command that the program is doing once, before the loop begins, that usely sets an counting veriable. this time its sets the veriable "i" to zero.

[*]the second part is a term, that when the program dont do it to in, the loop is ending, and the program continus. this time the loop is ending when i is not smaller than 10.

[*]the third part is a command, that the program does every time the code inside the loop is ending, before the loop starts again. this time, the command is adding 1 to the veriable "i". note that the commad "i++", is tha same as the command "i=i+1".
[list]

scanf("%d",&x);
this command tells the program to ask the user to give her a integer, and puts it at the veriable "x".

sum=sum+x;
this command adding "x" to "sum".

}
this sign cloasing the loop. the program will not repeat the code that came after that sign.

printf("nI puted all your numbers togeder, and got %d",sum);
this command tels the user how all the integers he inserted worth togater.

}
this sign close the main code, and the program ends.

#10
Mag

Mag

    NO YOU CANNOT

  • 1Emu Veteran
  • 1,998 posts
  • Gender:Male
  • Location:All Cats Go To Heaven
  • Interests:N/A
Click to view battle stats
ahh the complication !! :)

#11
TapeWurm

TapeWurm

    Member

  • Members
  • 84 posts
  • Location:Northern CA
  • Interests:80's nostalgia, movies.. big time, old school cartoons, retro-gaming, newsgroups, file sharing, writing, computers for 20+ years, good applications and trying to stay close to God, despite being a constant sinner.
Click to view battle stats
To hell with that! hahaha... too much for my brain! How about this:
10 print 10*10
run
100
end

There you have the program. command to run it. and the output...... granted, it won't be the next Quake Engine but hey.... hahaha

10 print"End of TapeWurm's Stupid Message"
run
End of TapeWurm's Stupid Message
End of TapeWurm's Stupid Message
End of TapeWurm's Stupid Message
End of TapeWurm's Stupid Message
End of TapeWurm's Stupid Message
End of TapeWurm's Stupid Message
End of TapeWurm's Stupid Message
End of TapeWurm's Stupid Message




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users