i am new student i had a home work but i cant get this done
how can i input in the same line a char and two integers
the output should be like this :

please enter candidate family condition, defect percent,
children number, working condition: s 20 0 1

in my program i wrote it like this:

printf("please enter candidate family condition, defect percent,
children number, working condition: ");
scanf("%c,%d,%d,%d",&status,&defect,&chnum,&w_cond);

i dont get it right when i input this : s 20 0 1
i tried without space even,but the teacher told us we have to input the data in one line and spaces between them

i would be happy if anyoe could help me
thx

>>scanf("%c,%d,%d,%d",&status,&defect,&chnum,&w_cond);
The problem is here: replace the commas with spaces.

Also MasterBlast, use code tags to post your code since it makes the code easier to read as well as the formatting is maintained.

Read the forum announcements.

thank you Ancient Dragon it worked well

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.