Kamis, 27 Maret 2014

Ebook Chapter 5 Problem Solving and Program Design in C

  • 5.4 Figure 5.8 Displaying a Celsius-to-Fahrenheit Conversion Table
#include <cstdlib>
#include <iostream>
#define cbegin 10
#define climit -5
#define cstep 5
using namespace std;

int main(int argc, char *argv[])
{
    int celcius;
    double fahrenheit;
   
    cout<<"Celcius \tFahrenheit"<<endl<<endl;
   
    for (celcius=cbegin;celcius>=climit;celcius -= cstep) {
        fahrenheit= 1.8*celcius+32.0;
        cout<<"celcius "<<celcius<<"\tfahrenheit "<<fahrenheit<<endl;
        }
       
    system("PAUSE");
    return EXIT_SUCCESS;
}

RUN :

0 komentar:

Posting Komentar

 

Anita © 2010

Blogger Templates by Splashy Templates