Jump to content

[HELP] C Programming :)

Go to solution Solved by CraveNirvana,

use scanf for taking in characters, printf for printing

 

If Windows tells you the program has had a problem and needs to close, you probably did something wrong in calling these.

Yea it happened like a couple of times now. 

 

Pretty simple. Since it's just a basic program, you should only need scanf for input and printf for output. Both of these are in stdio, but since you are new to this, have a look at these pages, should sort any doubts you have about parameters and format specifiers:

 

printf

http://www.cplusplus.com/reference/cstdio/printf/

precision should tell you how to output the way you want it.

 

 

scanf

http://www.cplusplus.com/reference/cstdio/scanf/

Neat-o thanks!

Hello guys, I'm in need of your assistance I need to make a C program with these conditions:

 

Create a C program that will input a character, an integer and two float numbers. Output the character, the integer number and the float number. 
 

  • Output the integer on the screen with a minimum of 5 characters.
  • Output the first float number with 5 characters with a maximum of 3 decimal places.
  • Output the second float number with 2 characters with a maximum of 6 decimal places.

Many thanks, friend of friends!

 

Hi guys thanks for all the references. I got the hang of it in such a short time. 

Link to comment
Share on other sites

Link to post
Share on other sites

Thank you for the advice

 

read up on the C standard libraries, mainly stdio.h.

Thank you for the advice. 

Link to comment
Share on other sites

Link to post
Share on other sites

use scanf for taking in characters, printf for printing

 

If Windows tells you the program has had a problem and needs to close, you probably did something wrong in calling these.

Link to comment
Share on other sites

Link to post
Share on other sites

Pretty simple. Since it's just a basic program, you should only need scanf for input and printf for output. Both of these are in stdio, but since you are new to this, have a look at these pages, should sort any doubts you have about parameters and format specifiers:

 

printf
http://www.cplusplus.com/reference/cstdio/printf/

precision should tell you how to output the way you want it.

 

 

scanf

http://www.cplusplus.com/reference/cstdio/scanf/

Link to comment
Share on other sites

Link to post
Share on other sites

use scanf for taking in characters, printf for printing

 

If Windows tells you the program has had a problem and needs to close, you probably did something wrong in calling these.

Yea it happened like a couple of times now. 

 

Pretty simple. Since it's just a basic program, you should only need scanf for input and printf for output. Both of these are in stdio, but since you are new to this, have a look at these pages, should sort any doubts you have about parameters and format specifiers:

 

printf

http://www.cplusplus.com/reference/cstdio/printf/

precision should tell you how to output the way you want it.

 

 

scanf

http://www.cplusplus.com/reference/cstdio/scanf/

Neat-o thanks!

Link to comment
Share on other sites

Link to post
Share on other sites

Just curious, but what are you using to compile the C program, if it's crashing?

Also, are you making sure to allocate enough space and not trying to enter a lot of stuff? Another thing that MAY cause issues, depending on what you're inputting, is making sure you flush the input buffer so you don't try to input odd characters into the wrong data types. 

 

Again, these are things to consider ONLY if you're still having trouble. Otherwise, ignore them.

Link to comment
Share on other sites

Link to post
Share on other sites

Sorry guys, but OP, did you actually look at least 3 chapters into C programming ?  You should be able to do this by glancing on first , idk 30 pages of book.

Like sorry, but how you want to learn something when you ask question on the very beggining.

ALSO, i didn't mean to be rude OR offensive.  I just really cannot comprehend how are people nowadays actually learning stuff.
 

Link to comment
Share on other sites

Link to post
Share on other sites

Sorry guys, but OP, did you actually look at least 3 chapters into C programming ?  You should be able to do this by glancing on first , idk 30 pages of book.

Like sorry, but how you want to learn something when you ask question on the very beggining.

ALSO, i didn't mean to be rude OR offensive.  I just really cannot comprehend how are people nowadays actually learning stuff.

 

 

Welcome to the forum.

Link to comment
Share on other sites

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×