Jump to content

New to c programming...don't know where to start

- - - - -

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

#1
Witnesses

Witnesses

    Newbie

  • Members
  • Pip
  • 4 posts
...

#2
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
First off, start by creating your main function, and declaring your variables, such as double radius, double height, etc. Then use scanf to input the values, and printf to print them out.

#3
Witnesses

Witnesses

    Newbie

  • Members
  • Pip
  • 4 posts
...

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
It looks like you're going in the right direction. Now, have you run it with test data to make sure you get the correct results? Compare the program's output to what you get by hand for the same data.
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,720 posts
Your surface area formula is only right if the cylinder has an open top. The second part should be 2*PI*rad*rad. Otherwise, it looks like your code is correct. You might want to check the input for negative values just for more error-catching. Otherwise, it's pretty good. Nice clean code.