Thread: Help with 6 programs

  1. #1
    Registered User
    Join Date
    Sep 2011
    Location
    germany
    Posts
    4

    Help with 6 programs

    Hey everyone,
    I am new at this forum, and am desperately looking for help with 6 very simple C programs. I am a total beginner and did some scratch work, but all the programs get way too many errors. I need to do a mandatory C-class, although I have never done this and am not a CS student. I would greatly, greatly, greatly appreciate your help .

    1. Write a program that prints a table with each line giving an integer, its square, and its cube. Ask the user to input the lower and upper limits for the table. Use a for loop.

    2. The ASCII value for a is 97. Ask the user to input the lower and upper limits for the table and make sure that the lower input is never below 32 and the upper limit is never above 127.

    3. Write a program where you read a string from the keyboard. Print the string like this:
    H
    e
    l
    l
    o

    4. Write a program you can read up to 20 integers into an array. A negative value ends the input loop and the negative value is not part of the array. Then by using a switch statement, pressing a (and return) computes the average of the array (and prints the result), h prints the highest number in the array, l prints the minimal number in
    the array, s prints the sum of all elements in the array and n prints the number of elements in the array. Use functions for each task. The result of these functions must be printed from the main() function.
    Hint: The prototype to compute the average looks like this:
    double compute_avg(int arr[], int num);

    5. Write a function int count_vowels(char str[]) that determines the number of vowels in a given string.
    Then write a simple test program where you can repeatedly enter a string and then the number of vowels is determined and printed to the screen (from the main() function). If the entered string is empty (it will contain only an \n then) the program should quit.

    6. Rewrite the function int count_vowels(char str[]) to walk the string using a pointer and address arithmetic. Reuse your test program from above.

    God bless whoever could help me out.

    Jake

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Ooook... post your effort and we will help you with your errors.

    ( Why six? Couldn't it be seven? )
    Devoted my life to programming...

  3. #3
    Registered User
    Join Date
    Sep 2011
    Location
    germany
    Posts
    4
    Heyy, that is what I have been given, 6 :-)

    I have saved the programs in my class lab, so cannot access them at the moment unfortunately, I have to wait till tomorrow 2 PM (of West European time) till I can access it again and copy them, so I could only get back to you then...

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    It's ok, I can wait.
    Devoted my life to programming...

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    While you're waiting this morning, take a read through Cprogramming.com - Programming Tutorials: C++ Made Easy and C Made Easy
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Sep 2011
    Location
    germany
    Posts
    4
    Quote Originally Posted by Salem View Post
    While you're waiting this morning, take a read through Cprogramming.com - Programming Tutorials: C++ Made Easy and C Made Easy
    thank you!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 11-09-2009, 07:03 AM
  2. GUI programs with C?
    By arya6000 in forum C Programming
    Replies: 7
    Last Post: 11-04-2007, 10:27 PM
  3. Need help with two programs please!
    By healyal in forum C Programming
    Replies: 4
    Last Post: 11-03-2007, 05:38 AM
  4. C# programs
    By OdIN in forum C# Programming
    Replies: 4
    Last Post: 09-28-2007, 07:55 PM
  5. Programs opening programs
    By LinuxPLC in forum C Programming
    Replies: 1
    Last Post: 11-21-2002, 12:50 PM