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 10 ... 24  | » ]
»» previous topic   »» next topic  


cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 11:45   »» 
sttp

You should add something about structures and pointers to your document.

dail8859

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 14:45   »» 
I have considered putting out a "part 2" to follow up. I had not planned on doing it because last time i check there were only 4 downloads of the pdf. I just checked and now theres around 15 :)

Once again, are there any people wanting to learn more about C? How many people read the pdf and understand it enough to do your own simple program? Because i would like to know how many people are getting this

If so i would make a part 2. It would cover pointers and structures and well.... Do you know of anything else? If there is a specific thing somebody is wanting to do just ask and ill see if i can cover it.

I would transition people over to bloodshed, since it is alot better than Miracle C

Cactus, if you know anything else i can cover, let me know. And if people are interested then ill put out another one.

Cheers

mmaarrkkuuss

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 16:24   »» 
in the example at the bottom of page 6: is 66/3 really 13.2? I don't get that:P

cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 18:07   »» 
66/3=22

You forgot to mention the switch statement, #define preprocessor directive (not sure if your program has it), and probably a few others. I'll read it more thoroughly later.

mmaarrkkuuss

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 18:07   »» 
STDP I meant page 3:P

cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 18:14   »» 
How was that a double post?

ROBO_HEN5000

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 19:24   »» 
while he was posting, you posted, so when he clicked "post" he thought it would be right after his first post, but you had posted first.

CONFUSING?!?!

~~~ROBO~~~

mmaarrkkuuss

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 20:01   »» 
I've been trying to make this work for a while:P Can someone please tell me what is wrong with this code?

int age;

printf("How old are you?");
scanf("%d", &age);

if ( age >= 18)
{
printf("You can receive your license.");
}
else
{
printf("You are not old enough yet.");
}
{
scanf("%c");
Return 0;
}

When I debug it it says that there's something wrong on the 2nd line.

~MmAaRrkKuUsS~

dail8859

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 23:06   »» 
You do know all of that code goes inside the main function, like this

#include

int main(void)
{
// all your code goes here
}

Put your code in there and it should work.
And also you have one too many { you do not need the { before the very last scanf.
And it should be return 0; instead of Return 0;

cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 23:21   »» 
You also need to add information about arrays and memory allocation and deallocation, and making your own functions.

>You do know all of that code goes inside the main function, like this

Not necessarily. You could put the code in your own function, whch could be called by main.

ROBO_HEN5000

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 21-Mar-07 23:41   »» 
Here it is, compiled and ready to go:

#include <stdio.h>

int main(void)
{
int age;

printf("How old are you?");
scanf("%d", &age);

if ( age >= 18)
{
printf("You can receive your license.");
}
else
{
printf("You are not old enough yet.");
};
scanf("%d");
return 0;
}

1. you have to add <stdio.h> after #include
2. I fixed all the brackets
3. had to be ("%d") not ("%c")

Hope that works for ya!!!

~~~{ROBO}=[31337]~~~

cactus1

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 22-Mar-07 17:27   »» 
The last scanf doesn't matter whether it is %d or %c.

mmaarrkkuuss

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 22-Mar-07 19:03   »» 
When it was a d I had to hit enter more than once:P thanks for the help!

ROBO_HEN5000

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 22-Mar-07 19:29   »» 
No problem, it was fun. I am about to put out a very simple program to calculate Pi, based off of Machin's Variation of the Gregory/Leibniz series, if anyone is familiar with it. I hope that the G++ debugger in Bloodshed will be able to compile it, but if not, I'll need some help! :P

~~~ROBO~~~

mmaarrkkuuss

»» models
»» homepage

Re: Do you want to learn to program in C   posted: 23-Mar-07 15:32   »» 
I think I get it now. I made the count program work! (YAY!)

~mmaarrkkuuss~



This topic has 357 replies on 24 pages [ « | 1 ... 2 3 4 5 6 7 8 9 10 ... 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