Write a statement, which will input several words followed by a return/enter key (new line character). Capture the input in the same variable declared above named 'sentence' and of length 60 (including null character)?
Please help! This program is for C++ and I use Dev-C++
I'll be so thankful to u guyz =)
PLZ help me write this basic C++ instructions?
char sentence[60];
scanf("%s", sentence);
Reply:#include%26lt;stdio.h%26gt;
main()
{
int i;
char sentence[60];
scanf("%s", sentence);
printf("enter sentence");
}
Reply:we can use
char sentence[60];
cin%26gt;%26gt;sentence;
or
for(int i=0;i%26lt;59;i++)
cin%26gt;%26gt;sentence[i];
cin[i]='\0';
cout%26lt;%26lt;sentence%26lt;%26lt;"\n";
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment