Thread: I need help!!!

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    8

    I need help!!!

    can you write the things that are below with C programming

    Write a C program that reads several characters from the user until ‘*’ is entered. Assume that the input only consists of lowercase letters. Your program will output the read input in a compressed manner. The idea is to display only one character and its number of occurences for repeated characters. If the input is “jddddyggrcnnfvvvwwwwwbbbf”, the program should display “jd4yg2rcn2fv3w5b3f” .

    Example Run:
    Please enter characters: cccctiiiisbbllllllkeeeeeeeen*

    c4ti4sb2l6ke8n

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    Quote Originally Posted by hasangursoy View Post
    can you write the things that are below with C programming
    You certainly can.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the form Hasangursoy!

    I'd suggest using something like while((c=getchar())!= '*') {, and then put each char into a char array, in order (so you'll need a little i counter variable).

    After all the input was in the array (make it 80 char's or so). Then use your compression logic on it to compress it as you want it.

    Note that this breaks the bigger problem down, into two smaller parts: 1) get input and 2) then do the compression on it.

    Trying to do this all at the same time, may be VERY frustrating!

  4. #4
    Registered User
    Join Date
    Nov 2010
    Posts
    8
    thaks
    I know it is very frustrating but it is my homework

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Please tell me you're not sitting there, waiting for us to do your homework. If so...you'll be waiting a long time.

  6. #6
    Registered User
    Join Date
    Nov 2010
    Posts
    8
    I'm sorry I didn't see this rule !

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    It's not frustrating, if you take it inch by inch - anything's a cinch, right?

    What have you tried to get your input? Post it up, young man! Time's a'wasting.

    C'mon and put some work into it - that's the best way to really learn something - doing it, with occasional bits of advice.

  8. #8
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >I'm sorry I didn't see this rule !
    I weep for today's youth. A written rule shouldn't even be necessary. It's common sense that one should do one's own work, especially when the entire point of the work is education.
    My best code is written with the delete key.

  9. #9
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Preach it, sister!

  10. #10
    Registered User
    Join Date
    Nov 2010
    Posts
    8
    Quote Originally Posted by Adak View Post
    It's not frustrating, if you take it inch by inch - anything's a cinch, right?

    What have you tried to get your input? Post it up, young man! Time's a'wasting.

    C'mon and put some work into it - that's the best way to really learn something - doing it, with occasional bits of advice.


    I cannot write syntax of this problem. my input aaaabbbbbcccccddddde*

  11. #11
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by hasangursoy View Post
    I cannot write syntax of this problem. my input aaaabbbbbcccccddddde*
    LOL... they are asking you to post C language source code that shows you even tried to solve this problem for yourself.

    Most of the "big guns" here will help you fix problems --they've helped me-- but they are not going to do this for you.

    As it is said: "One can starve to death watching the chef work"

  12. #12
    Registered User gaurav9991's Avatar
    Join Date
    Oct 2010
    Location
    Pune, Maharashtra, India
    Posts
    69
    can you ever written "hello world" program? if not, try it yourself first

Popular pages Recent additions subscribe to a feed