This is an archive of a previous version of Sodarace.

Please visit http://sodarace.net for the latest version.

forum  |  »» sodaplay
 
»» forums  »» community discussion forum

subject: Do you want to learn to program in C

357 replies on 24 pages. most recent reply: Tues, Aug 28 10:58 PM by matthew102000

»» back to topic list  

This topic has 357 replies on 24 pages [ « | 1 2 3 4 5 6 7 8 9 ... 24  | » ]
»» previous topic   »» next topic  


edlinfan

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 17-Mar-07 03:40   »» 
> I hoped it was halfway decent.
Indeed it was. The programming was explained well: I just fixed some bad grammar.

Unfortunately, after I corrected about half of the file, my PDF editor locked up tight. It's now been deadlocked for roughly two hours, but I still hope that it will recover so I can save the file. :-(

im_an_alien

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 17-Mar-07 04:27   »» 
Oh, it's here already? *downloads*

im_an_alien

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 17-Mar-07 04:40   »» 
stdp, but...

a) Start with printf, not variables. Just copy/paste them around and change the numbers.
b) getch(); is a lot better for pausing programs than scanf("%c") because
...1) It recognises any key, not juse enter
...2) You can't type random stuff in before you press enter =P
...3) W00t! A fellow OpenOffice.org user! (it's OpenOffice.org, not OpenOffice, there IS a difference!)
c) "current_loc = current_loc + distance" should be "current_loc += distance"

matthew102000

»» models

Re: Do you want to learn to program in C   posted: 18-Mar-07 15:36   »» 
with the fact that im only 13, i dont get it. its too complicated for me.

matt wuz here

dail8859

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 18-Mar-07 17:51   »» 
Im an alien
I probalby will not change the manual in any major way. I will leave it the way it is starting with variables.

Secondly, i did not realize getch() worked like that. I guess i just never tried it out. That works much better than scanf("%c").

I do like OpenOffice.org alot. And yes I did catch where i put OpenOffice.

I put "current_loc = current_loc + distance" so that it would not confuse people and so i would not have to explain any more that what i had to.

And matthew, if you think you would like programming but just dont understand the pdf then i would suggest finding a website that explains programming from the very basics. If you dont that fine too. I will try to find some good websites tommorow if you are interested.

matthew102000

»» models

Re: Do you want to learn to program in C   posted: 19-Mar-07 22:27   »» 
never mind. i get it.

one question thogh. i made a prodram, but it opens in notepad, even thogh i saved it as a .c file. what do i need to do???

matt wuz here

edlinfan

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 19-Mar-07 23:16   »» 
If you used notepad to save the program, you need to put the file name in quotes when you save it.

So it looks like this: "program.c"
instead of this: program.c

Otherwise Notepad will not-so-helpfully append .txt to the file name, and cause the problem.

matthew102000

»» models

Re: Do you want to learn to program in C   posted: 19-Mar-07 23:35   »» 
it still dosent work.

dail, i tried your counting program. it dosent work, and i cant find the problem.

#include <stdio.h>
int main (void)
{
int count, number;
printf(“How high should I count? ”);
scanf(“%d”, &number);
count = 0;
while ( count <= number)
{
printf(“%d \n”, count);
count++;
}
scanf(“%c”);

return 0;
}

what did i do wrong?

matt wuz here

cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 20-Mar-07 01:40   »» 
Click "Save As" on the File Menu.

In the Save dialog, make sure Save as type says "All files"

Then label the file test.c

Did you compile the file?

dail8859

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 20-Mar-07 15:15   »» 
The code is correct. The only things i can think of
1) It MUST have the .c extention, which you are trying to do if you havent already
2) Compile, build, then execute. This is on page 7.

If you still cant get it to work, tell us specifically where it is getting stuck at.

I am glad you are getting it now

mmaarrkkuuss

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 20-Mar-07 18:08   »» 
I don't get it:P I'm 12 years and 5 days old so I better try to

matthew102000

»» models

Re: Do you want to learn to program in C   posted: 20-Mar-07 22:21   »» 
i give up!!!

whatever i do, it wont work!!! i like what youve done dail, but its too complicated for me.

matt wuz here

ROBO_HEN5000

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 00:39   »» 
Hey, I put the counting program in Bloodshed and used the GNU compiler to ,uh, compile it. Here's the new one:

#include <stdio.h>
int main (void)
{
int count, number;
printf (“How high should I count?”/n);
scanf (“%d”/n, &number);
count = 0;
while(count <= number)
{
printf(“%d”, count);
count++;
};
scanf (“%c”);

return 0;
};

The /n goes outside of the quotes, and you left out some semicolons. This is as far as I could figure it out, but it still doesn't work. Maybe someone with more programming skills than me could fix it please?

~~~ROBO~~~

cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 01:09   »» 
>The /n goes outside of the quotes
No... /n needs to be inside, becuase it represents new line.

The semicolon is also probably a source of problems.

I didn't read the article yet, so I don't know what the original is.
Here's my version. I'm gonna test it tomorrow.
#include <stdio.h>

void main () //Simplify it as much as possible
{
int count, number;
printf (“How high should I count?/n");
scanf (“%d", &number);
count = 0;
while(count <= number)
{
printf(“%d/n”, count);
count++;
} //Semicolon not needed.
//scanf (“%c"); //Er.. What's this for?
}

cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 11:37   »» 
Ok, my version works.
#include <stdio.h>

void main () //Simplify it as much as possible
{
int count, number;
printf ("How high should I count?\n");
scanf ("%d", &number);
count = 0;
while(count <= number)
{
printf("%d\n", count);
count++;
} //Semicolon not needed.
//scanf ("%c"); //Er.. What's this for?
}



This topic has 357 replies on 24 pages [ « | 1 2 3 4 5 6 7 8 9 ... 24  | » ]


»» previous topic   »» next topic  

»» back to topic list  »» top of the page  

PLEASE READ THE FORUM GUIDELINES AND ALWAYS PREVIEW TO CHECK MESSAGES BEFORE POSTING...
...Help keep our forums creative and constructive. Thank you.


»» forum home