SmileC Beginner Projects?

Posts 1–4 of 4 · Page 1 of 1
C Beginner Projects?
I've been looking into C recently, and I really want to master it. Would appreciate if anyone could recommend easy projects that I can work on to help improve my knowledge on C. Something simple like a calculator, ect.. Thanks in advance! Btw, my first post yay
Ei man,
in 2 days I will have the C exam at the university and I've been studing this language for a while actually.
If you are just starting your studies I suggest you to begin with the bases: I'd say that you might start with cicles " for() ", while() " ( obviously to do it you have to know the very bases ). The pointers are very important; you will need to use them when you will learn functions and procedures ( void ): in particular you will use the pointers ( which can be of many types --> int *f, char *c, float *b etc ) when you have to update the value of a variable inside a function/procedure. Mind that arrays ( an other essential component of C ) will never requires the " * " because they are always passed are pointers ( char s[20], in a procedure, will be changed automatically, you don't have to pass char *s[20] ) --> in particular C considers an array with his first cell (char s[0] = char *s). Consequently you have to learn the structures because they allow you to recognise groups of elements which could have similar features.
Actually there are undreds of things to learn, everyone might be consider as a beginner ( or naat?! );
if you need an help or some real examples you can contact me.
Regards
Quote Originally Posted by garupede View Post
Ei man,
in 2 days I will have the C exam at the university and I've been studing this language for a while actually.
If you are just starting your studies I suggest you to begin with the bases: I'd say that you might start with cicles " for() ", while() " ( obviously to do it you have to know the very bases ). The pointers are very important; you will need to use them when you will learn functions and procedures ( void ): in particular you will use the pointers ( which can be of many types --> int *f, char *c, float *b etc ) when you have to update the value of a variable inside a function/procedure. Mind that arrays ( an other essential component of C ) will never requires the " * " because they are always passed are pointers ( char s[20], in a procedure, will be changed automatically, you don't have to pass char *s[20] ) --> in particular C considers an array with his first cell (char s[0] = char *s). Consequently you have to learn the structures because they allow you to recognise groups of elements which could have similar features.
Actually there are undreds of things to learn, everyone might be consider as a beginner ( or naat?! );
if you need an help or some real examples you can contact me.
Regards
Ehhh i need help


What is initial ?



And how this works ?
number_of_pencils*pencils
+ number_of_notebooks*notebooks + lunchbox



Here is my code



// Example program #1 from Chapter 5 of Absolute Beginners Guide
// to C, 3rd Edition
// File Chapter5ex1.c

/* This is a sample program that list three kids and their school
supply needs, as well as cost to buy the supplies */

#include <stdio.h>

main()
{
// Set up the variables, as well as define a few

char firstInitial, middleInitial;
int number_of_pencils;
int number_of_notebooks;
float pencils = 0.23;
float notebooks = 2.89;
float lunchbox = 4.99;


//The information for the first child

firstInitial = 'J';
middleInitial = 'R';

number_of_pencils = 7;
number_of_notebooks= 4;

printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n",
firstInitial, middleInitial, number_of_pencils,
number_of_notebooks);

printf("The total cost is $%.2f\n\n", number_of_pencils*pencils
+ number_of_notebooks*notebooks + lunchbox);


//The information for the second child

firstInitial = 'A';
middleInitial = 'J';

number_of_pencils = 10;
number_of_notebooks= 3;

printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n",
firstInitial, middleInitial, number_of_pencils,
number_of_notebooks);

printf("The total cost is $%.2f\n\n", number_of_pencils*pencils
+ number_of_notebooks*notebooks + lunchbox);

number_of_pencils = 10;
number_of_notebooks= 3;

printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n",
firstInitial, middleInitial, number_of_pencils,
number_of_notebooks);

printf("The total cost is $%.2f\n\n", number_of_pencils*pencils
+ number_of_notebooks*notebooks + lunchbox);

//The information for the third child

firstInitial = 'M';
middleInitial = 'T';

number_of_pencils = 9;
number_of_notebooks= 2;

printf("%c%c needs %d pencils, %d notebooks, and 1 lunchbox\n",
firstInitial, middleInitial, number_of_pencils,
number_of_notebooks);

printf("The total cost is $%.2f\n\n", number_of_pencils*pencils
+ number_of_notebooks*notebooks + lunchbox);

return 0;
}
Quote Originally Posted by familyguy2 View Post
What is initial ?



And how this works ?
number_of_pencils*pencils
+ number_of_notebooks*notebooks + lunchbox
Initial, basically, is the first letter of the child's name.
Then, that expression, first calculates the *, then the +'s. I take this opportunity to let you remember that C, as well as other languages, has different piority levels, which means that product comes before a sum.
To be clear, sum and subtraction have the same priority and product and division have the same priority as well.
The question now might be " if I have an expression with only product and division? Who comes before? " --> here I suggest ( of course I got suggested to ) to put many parenthesis, you just need to remember which one must be closed and you are okay: put a parenthesis everytime that you think that there is a specific operation; the computer ( if you remember to close every parenthesis ) won't find it harder to compile and you will have more mental order perhaps.

I hope to have been clear and satisfing for you
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us