hi ,i want to know that if i m taking the input from user in C through scanf what should be the code if the requirments are following.
1.should accept string minimum of 3 and maximum of 15 characters.
2.accept alphabets ,blank space hyphen(-)and &
3. first latter should be uppercase.
and another string should
1. accept blank spaces with dot(.)and apostrophe .
mohan_198505
0
Newbie Poster
Recommended Answers
Jump to PostI don't think you can use scanf and meet those criteria, scanf will not accept spaces.
I suggest using fgets and parsing the line you get back to validate.
Jump to PostEven if you could use scanf for your purposes, it is better to use fgets anyway.
All 7 Replies
Murtan
317
Practically a Master Poster
death_oclock
103
Posting Whiz
csurfer
422
Posting Pro
Aia
1,977
Nearly a Posting Maven
csurfer
422
Posting Pro
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Aia
1,977
Nearly a Posting Maven
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.