answersLogoWhite

0

They do different things, read the manual/help for details.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How do you write a program using c plus plus to calculate change of dollar?

Here is a program that would calculate the change of a dollar: #include <stdio.h> int main(); { float total=0; float bill=0; float pay=0; printf("How much do you have to pay: "); scanf("%f", &bill); printf("How much did you give out: "); scanf("%f", &pay); total = bill - pay; printf("Your change is: %.2f", total); /*.2 meant 2 digits after the decimal*/ getchar(); getchar(); /*I use getchar(); to pause the program till you press 'enter'*/ return 0; } Here is the program running: How much many do you have to pay: 5.64 /*5.64 is user input*/ How much many did you give out: 4.72 /*You can redo the questions if need be*/ Your change is: 0.92 /*This is where you press 'enter' to close the program from the getchar();*/ I hope this helped :D


How do you read a character from the keyboard and will store it in the variable?

Use the scanf() function from the C standard library.


Can you use scanf to get a string to a c program?

Certainly. That's what sequence %s is good for.


What is the use of getchar?

gets()Reads characters from stdin and stores them as a string into str until a newline character ('\n') or the End-of-File is reached.The ending newline character ('\n') is not included in the string.getchar()Returns the next character from the standard input (stdin).It is equivalent to getc with stdin as its argument. === ===


What are the limitations of getchar and scanf functions for strings?

cause getchar only read a character and scanf read only word before first space but not other words and letters.


How can we read two strings using c program?

#include,stdio.h>main(){char string1[20],string2[20]printf("enter the first string");scanf("%s",string1);// reading the string1printf("enter the second string");scanf("%s", string2);// reading the the string2printf( "the first string is %s",string1);// printing the string1printf("the second string is %s",string2);// printing the string2}the problem of using scanf is that it does not take space. so we can use gets for it.ie instead of scanf("%s",string1); we can use gets(string1); .


Can you compile program without header file?

Yes,we can compile our program without header file without any error,but we can not use any predefine functions like printf,scanf.


How you get the size of arrays from user?

in c simply add three lines in the begining of your program: int x; printf("enter the size of the array to be entered :"); scanf("%d",&x); after that use x as your maximum limit of array in your program. in c++ just replace above printf & scanf statements by cout<<"enter the size of the array to be entered :"; & cin>>x; respectively and do not use brackets.


Can you use scanf function within printf function?

Yes: double d; printf ("scanf's just returned %d\n", scanf ("%lf", &d));


Why not use the ampression symbol in scanf statement in function?

scanf is a function, not a statement. Example: int a; char name[12]; scanf ("%d %s", &a, &name[0]);


Scanf function in c for strings?

Use '%s', eg: char name[64]; scanf ("%s", name);


Why do people use dots or underscores in filenames instead of spaces?

Because of how the program is written you need to use punctuation instead of spaces.