Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anusha.p Group Title

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

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    anu do you need the code in C ??

    • 2 years ago
  2. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    yes...

    • 2 years ago
  3. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    ok give me a min

    • 2 years ago
  4. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    #include<stdio.h> #include<conio.h> 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(); }

    • 2 years ago
  5. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    @anusha.p run the program and tell me if there are any errors

    • 2 years ago
  6. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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

    • 2 years ago
  7. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    hey i can tell you of the IDE

    • 2 years ago
  8. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    you can use turbo C++

    • 2 years ago
  9. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    you want explanation for which line ?

    • 2 years ago
  10. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i have turbo c actually...but it doesn't work properly.... 3rd one.. W.P

    • 2 years ago
  11. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    That solution is bad juice @annas - I can buffer overflow all in your bis-nass. :P

    • 2 years ago
  12. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    Little bit of buffer overflow, little bit of shellcode, and I've taken over your program.

    • 2 years ago
  13. ParthKohli Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I know that it involves some work with the substrings. Is it okay if I show it in Python?

    • 2 years ago
  14. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    no...no at all ok..@ParthKohli

    • 2 years ago
  15. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    Also, @annas walking the asker through the question instead of just providing the solution would be a better approach to this problem.

    • 2 years ago
  16. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    @anusha.p How long have you been coding in C?

    • 2 years ago
  17. ParthKohli Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

    • 2 years ago
  18. ParthKohli Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I'm not the best at Computer Science, but that's my attempt at it.

    • 2 years ago
  19. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i'm a beginner... @farmdawgnation

    • 2 years ago
  20. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    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

    • 2 years ago
  21. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    Got it. And, they asked you to be able to parse the string "WORDPROCESSING" with no spaces? Is that correct?

    • 2 years ago
  22. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    yes... @farmdawgnation

    • 2 years ago
  23. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    @farmdawgnation sire i m really sorry next time will ask first that what they have done. i'll not provide solution again

    • 2 years ago
  24. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    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?

    • 2 years ago
  25. ParthKohli Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    stringgiven = "WORDPROCESSING" first_word_initial = stringgiven[0] second_word_initial = stringgiven[4] print(first_word_initial + "." + second_word_initial) Python, maybe.

    • 2 years ago
  26. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    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.

    • 2 years ago
  27. farmdawgnation Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    Then go back and figure out what functions I need to actually implement that functionality.

    • 2 years ago
  28. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    ok... @farmdawgnation

    • 2 years ago
  29. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    main() { char s[20]; printf("enter the string"); scanf("%s,s); //then how to print WORD PROCESSING.?? @farmdawgnation

    • 2 years ago
  30. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    yes @anusha.p where do you need help ?

    • 2 years ago
  31. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    how to print WORD PROCESSING

    • 2 years ago
  32. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    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);

    • 2 years ago
  33. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    where a and b are two arrays (char type)

    • 2 years ago
  34. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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..

    • 2 years ago
  35. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    let me think if i can get any other solution for your problem

    • 2 years ago
  36. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    yes i have got it.

    • 2 years ago
  37. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    hint: try to use for loop

    • 2 years ago
  38. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    for(j=0;j<14;j++) { if(j==4) printf(" "); printf("%c",word[j]); } understand ???

    • 2 years ago
  39. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    don't use loops. use %.4s.....or something like these only....:(

    • 2 years ago
  40. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    but this can only be done by loop. loop helps here to break the string into two parts

    • 2 years ago
  41. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    the final..answer is.......... #include<stdio.h> #include<conio.h> 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(); }

    • 2 years ago
  42. anusha.p Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    u r right.. @annas

    • 2 years ago
  43. annas Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    thank you :)

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.