Thread: Program Help

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    43

    Program Help

    Well I'm not sure if I'm on the right track or If I way off but this is what I have so far

    Code:
    #include <stdio.h>
    #include <ctype.h>
    
    void step1()
    {
        double temp;
    
        printf("Please enter a the sample temperature in Degrees Kelvin\n");
        scanf("%lf", &temp);
    
        return;
    }
    
    void step2()
    {
        double temp;
        char input;
    
        printf("Do you wish to convert the sample into (C)Celcius or (F)Fahrenheit?\n");
        scanf("%c", &input);
    
        if (input == 'c'){
            void step3()
        }
        else if (input == 'f'){
             void step4()
        }
             else
             printf("Invalid Option!\n");
    
        return;
    }
    
    void step3()
    {
        int cel;
        double temp;
    
        cel = (temp-273);
        printf("Temperature in Celcius =%lf \n",cel);
    
    }
    
    void step4()
    {
        int cel;
        int fah;
        double temp;
    
        cel = (temp-273);
        fah = (9*cel/5+32);
        printf("Temperature in Farenheit =%lf \n", fah);
    
    
    
    int main()
    {
        void step1()
        void step2()
    
    }
    Basically, I need the program to accept a number (in Kelvin Degrees) then convert it into Farenheit or Celcius. I have all the correct conversions but I'm struggling with the modular programming aspect of it.

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    What happens when you compile this code?

    HINT: It doesn't.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM