Jump to content

need help writing this c program

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
bbbballin

bbbballin

    Newbie

  • Members
  • Pip
  • 1 posts
i have to write a program where i input two positive integers (L and H) which are both less than 21. the program then prints out a box of solid asterisks wit L horizontal asterisks and H vertical asterisks.

i dont really know where to start... can someone tell me?

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
If you mean C++ you want to start by familiarizing yourself with the IO Stream Library in particular cin and cout. If you mean C you want to start by familirarizing yourself with stdio in particular printf and scanf/sscanf/fgets.

#3
oliver.rush

oliver.rush

    Newbie

  • Members
  • PipPip
  • 24 posts
Maybe before reading those libraries, you'd better make an algorithm? You know, decide how you gonna solve the problem before starting solving it.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Nested for loops.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,717 posts
Write out pseudocode. Start with plain English, write how you would do it manually, then try to convert that into programming structures.
sudo rm -rf /

#6
fantanoice

fantanoice

    Newbie

  • Members
  • PipPip
  • 26 posts
An example of some pseudocode would be this:

- Declaring your variables (in this case, L and H)
- Assigning your variables to the user-inputted numbers
- Printing them to the screen

It's in plain English and describes the steps required for your program. You can break it down into smaller, simpler steps, as you wish. The simpler and smaller your steps are, the easier it will be program, because you'll have a better understanding on what needs to happen.

Hope that helps. :)