someboddy Posted October 22, 2002 Author Posted October 22, 2002 Type this program:#include<stdio.h> void main(){ int a[5],b[5],c[5],i; for (i=0;i<5;i++){ printf("ngive me two numbers('a,b') "); scanf("%d,%d",&a,&b); c=a+b; } for (i=0;i<5;i++){ printf("n %d+%d=%d",a,b,c); } printf("nnn");} there are parts here that I have allrady explaind, so I only explain the new thing: the array. array is a set of variables that have serial numbers. when you want to use one of the variables in the array, you use it like this: <array name>[<variable serial number>]. for example: bla[5],x[7],set[9]. array is defined like a normal variable, only that a array have a "["&"]" around the number of variables. for example:int thing[3]; defines a array with a place for 3 integer variables. the serial number of the first variable in the array is 0. for example:if we have a array: staff[6], then the variables are: 'staff[0]','staff[1]','staff[2]','staff[3]','staff[4]' and 'staff[5]'. instend of puting a number inside the "["&"]", you can put an integer in it, like something. this makes arrays extreamly useful in for loops.
someboddy Posted October 23, 2002 Author Posted October 23, 2002 this time I have two simple programs:#include <stdio.h> void main(){ float a,b,c; printf("nnGive me two numbers "); scanf("%f,%f",&a,&; c=a+b; printf("n %f+%f=%fnn",a,b,c);} this is a simple adding program, but it have diferent from the program in the second lesson: it uses real numbers, that mean that we can do 4.79+5.3, for example.using real numbers it's vwry similar to using integers but when you defining the variable, write "float " instend of "int ", and when using it in a "printf""scanf", write "%f" instend of "%d". and one more thing: you cant put a real number in a integer.
someboddy Posted October 23, 2002 Author Posted October 23, 2002 type this program:#include <stdio.h> void main(){ char anser; printf("nnDo you like me?(y/n) "); scanf ("%c",&anser); if (anser=='y') printf("nI like you toonn"); if (anser=='n') printf("nThis means war!!!nn");} the char is a single character variable.
someboddy Posted November 1, 2002 Author Posted November 1, 2002 type this program:#include<stdio.h>void main(){ char name[100]; printf("nnWhat's your name? "); scanf("%s",&name); printf("Hello %snn",name);} when you make an array of char's, you can use it as a string, but instend of typing "%c", type "%s".
someboddy Posted November 1, 2002 Author Posted November 1, 2002 These are the basic of c, and as soon as I whill learn C++, I whill teach you that too.
emsley Posted November 1, 2002 Posted November 1, 2002 Just one question?What the hell would it do if i learned it?People who talk programing are crazy
someboddy Posted November 1, 2002 Author Posted November 1, 2002 You will be able to create programs and games.
emsley Posted November 1, 2002 Posted November 1, 2002 I dont want to "clutter" your lessons up but what software do i need to use this programming, do you have any sites were i can get the basics.Is c+ used on the internet for designing webpages,Whats the best programming i can learn to design webpages.Sorry to drill you with questions.
someboddy Posted November 1, 2002 Author Posted November 1, 2002 If you are planing to write in HTML, learn Javascript, and if you want to write complex programs, use Java.If you are using front-page, learn visual-basic. all of the office programs sopport it.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now