shaswat
Advanced Member level 4
- Joined
- Jul 2, 2013
- Messages
- 115
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 18
- Activity points
- 963
Hello Everyone!!
While I was trying some online C language quiz, I was stuck in problem where the constraints was to take strings that only have 'R' an 'S' letter. I searched it online and got some suitable resource about the scanset https://www.geeksforgeeks.org/scansets-in-c/. However, I have not got complete answer as I need to take input inside the while statement.
Here is the snippet:
This code just take input only as first time, and print the same on the output window for 10 times.
I am not sure how to take string after each display of printf function.
Any help or hint would be really appreciable.
While I was trying some online C language quiz, I was stuck in problem where the constraints was to take strings that only have 'R' an 'S' letter. I searched it online and got some suitable resource about the scanset https://www.geeksforgeeks.org/scansets-in-c/. However, I have not got complete answer as I need to take input inside the while statement.
Here is the snippet:
Code:
#if 1
int main()
{
int loop=10;
u8 str[122];
while(loop--)
{
scanf("%[^\n]s", str);
printf("%s\n",str);
}
return 0;
}
#endif // 1
This code just take input only as first time, and print the same on the output window for 10 times.
I am not sure how to take string after each display of printf function.
Any help or hint would be really appreciable.