Re: i need help about Turbo C




sarathy wrote:

pipito wrote:
Hi...i am a beginner in C programming...
my question is like this...
im using the scanf in C to accept input data in output area,

printf("name: ");scanf("%s",name);
printf(Address: ");scanf("%s",address);
printf("age: ");scanf("%d",age);

when i run the program, i use a spacebar in the input data, the
following string after i press the space bar doesnt read anymore or it
skip and going to the next line

name: pipito otso
address: manila philippines
age: 18


Hi Pipito, This is manmeet Mittal, U can also write the code as follows :-
printf("\n Name"); scanf("%s",name);
printf("\n Address"); scanf("%s",address);
printf("\n Age"); scanf("%d",&age);
' \n ' is an escape sequence which causes the output in new line. In input of age u can >> use ' & ' ampersand. U can also write code to input a string as follows :-
puts("\n Name"); gets(name);

I think it will serve your purpose. If u have any query then send ur queris.

Name :-Kumar Gaurav
address :-India
age 19

.



Relevant Pages

  • Re: i need help about Turbo C
    ... im using the scanf in C to accept input data in output area, ... You need to add a "\n" or the printf won't always show. ...
    (comp.lang.c)
  • i need help about Turbo C
    ... im using the scanf in C to accept input data in output area, ... when i run the program, i use a spacebar in the input data, the ... name: pipito otso ...
    (comp.lang.c)
  • Re: Can some one tell me what is wrong with this program ?
    ... triangle *T; ... report the lack of memory.) ... there was an error in the input data. ... Unlike scanf, printf does not require an 'l' in the format specifier. ...
    (comp.lang.c)
  • Re: i need help about Turbo C
    ... when i run the program, i use a spacebar in the input data, the ... The %s in your call to scanf stops at the first white space (in this ... the space between pipito and otso). ... remains in the buffer. ...
    (comp.lang.c)
  • Re: i need help about Turbo C
    ... im using the scanf in C to accept input data in output area, ... Also your scanf doesn't eat the newline. ... You need to flush the input stream [hint: ...
    (comp.lang.c)