anonymous
  • anonymous
Given the string "WORDPROCESSING",write a program to read the string from the terminal and display the same in the following formats; (a)WORD PROCESSING (b)WORD PROCESSING (c)W.P
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
anu do you need the code in C ??
anonymous
  • anonymous
yes...
anonymous
  • anonymous
ok give me a min

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
#include #include void main() { char a[10],b[11]; // declaring two character arrays clrscr(); // clear screen printf("Enter the sentence:\n"); scanf("%4s%10s",a,b); // getting value from user (%s = datatype for string) printf("1)%s %s\n",a,b); printf("2)%s\n%s\n",a,b); printf("3)%.1s.%.1s",a,b); getche(); }
anonymous
  • anonymous
@anusha.p run the program and tell me if there are any errors
anonymous
  • anonymous
i can't run...since i don't have any software...for c.. i think it's correct...... just explain me the 3 rd one..annas
anonymous
  • anonymous
hey i can tell you of the IDE
anonymous
  • anonymous
you can use turbo C++
anonymous
  • anonymous
you want explanation for which line ?
anonymous
  • anonymous
i have turbo c actually...but it doesn't work properly.... 3rd one.. W.P
farmdawgnation
  • farmdawgnation
That solution is bad juice @annas - I can buffer overflow all in your bis-nass. :P
farmdawgnation
  • farmdawgnation
Little bit of buffer overflow, little bit of shellcode, and I've taken over your program.
ParthKohli
  • ParthKohli
I know that it involves some work with the substrings. Is it okay if I show it in Python?
anonymous
  • anonymous
no...no at all ok..@ParthKohli
farmdawgnation
  • farmdawgnation
Also, @annas walking the asker through the question instead of just providing the solution would be a better approach to this problem.
farmdawgnation
  • farmdawgnation
@anusha.p How long have you been coding in C?
ParthKohli
  • ParthKohli
Or I'd just tell you the concept. 1) Put a space between those two words by using substrings(I guess). 2) Isn't that the same? 3) Use substrings and concatenation.
ParthKohli
  • ParthKohli
I'm not the best at Computer Science, but that's my attempt at it.
anonymous
  • anonymous
i'm a beginner... @farmdawgnation
anonymous
  • anonymous
printf("3)%.1s.%.1s",a,b); %.1s will take the first value of the string for example if the string is hello then it will take h from the string
farmdawgnation
  • farmdawgnation
Got it. And, they asked you to be able to parse the string "WORDPROCESSING" with no spaces? Is that correct?
anonymous
  • anonymous
yes... @farmdawgnation
anonymous
  • anonymous
@farmdawgnation sire i m really sorry next time will ask first that what they have done. i'll not provide solution again
farmdawgnation
  • farmdawgnation
That's peculiar, but ok. So, you'll find annas's solution should work pretty well glancing over it, but I would advise you to step through the process of building out the solution yourself, if you can, using comments. Sometimes, if I'm stuck on a hard problem it helps to write in comments what my code is going to do and then fill in the actual code. Make sense?
ParthKohli
  • ParthKohli
stringgiven = "WORDPROCESSING" first_word_initial = stringgiven[0] second_word_initial = stringgiven[4] print(first_word_initial + "." + second_word_initial) Python, maybe.
farmdawgnation
  • farmdawgnation
So, I may start with... void main() { // Read string from the terminal } And then add additional comments in main until the entire behavior is specified.
farmdawgnation
  • farmdawgnation
Then go back and figure out what functions I need to actually implement that functionality.
anonymous
  • anonymous
ok... @farmdawgnation
anonymous
  • anonymous
main() { char s[20]; printf("enter the string"); scanf("%s,s); //then how to print WORD PROCESSING.?? @farmdawgnation
anonymous
  • anonymous
yes @anusha.p where do you need help ?
anonymous
  • anonymous
how to print WORD PROCESSING
anonymous
  • anonymous
printf("1)%s %s\n",a,b); this is the way to print "WORD PROCESSING" but it will work only if you get input in following format scanf("%4s%10s",a,b);
anonymous
  • anonymous
where a and b are two arrays (char type)
anonymous
  • anonymous
u should enter WORDPROCESSING as a single word....and u have to print it as...WORD PROCESSING....without using..a for WORD.. and b for PROCESSING..
anonymous
  • anonymous
let me think if i can get any other solution for your problem
anonymous
  • anonymous
yes i have got it.
anonymous
  • anonymous
hint: try to use for loop
anonymous
  • anonymous
for(j=0;j<14;j++) { if(j==4) printf(" "); printf("%c",word[j]); } understand ???
anonymous
  • anonymous
don't use loops. use %.4s.....or something like these only....:(
anonymous
  • anonymous
but this can only be done by loop. loop helps here to break the string into two parts
anonymous
  • anonymous
the final..answer is.......... #include #include void main() { char s[10],d[11]; clrscr(); printf("Enter the string: "); scanf("%4s%10s",s,d); printf("(a)%s %s\n",s,d); printf("(b)%s\n%s\n",s,d); printf("(c)%.1s.%.1s",s,d); getch(); }
anonymous
  • anonymous
u r right.. @annas
anonymous
  • anonymous
thank you :)

Looking for something else?

Not the answer you are looking for? Search for more explanations.