0

Everybody, post your very first C++ code up here if you still have it, heres mines with help from the book I am reading and Narue for the help of keeping the window open, thanks pal.

//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius  * (212 - 32)/100 + 12
//

#include <iostream>
 
using namespace std;
 
int main()
{
  // enter the temperature in Celsius
  int celsius;
  cout << "Enter the temperature in Celsius: ";
  cin >> celsius;
 
  // calculate conversion factor for Celsius to Fahrenheit
  int factor;
  factor = 212 - 32;
 
  // use conversion factor to convert Celsius into Fahrenheit values
  int fahrenheit;
  fahrenheit = factor * celsius/100 + 32;
 
  // output the results
  cout << "Fahrenheit value is: " << fahrenheit << endl;
 
  // remove extraneous characters from the input stream
  char ch;
  while ( cin.get ( ch ) && ch != '\n' )
	;
 
  // pause until the user hits Enter
  cout << "Press Enter to continue...";
  cin.get();
}
4
Contributors
8
Replies
14
Views
12 Years
Discussion Span
Last Post by Young Teck 06
0
#include<iostream>
using namespace std;

int main()
{
    cout<<"Hellp World"<<endl;
    return 0;
}
0
#include<iostream>
using namespace std;

int main()
{
    cout<<"Hellp World"<<endl;
    return 0;
}

Freudian slip, do you want the world to hellp you, or do you think the world needs hellp? Anyway, cute!

0

Yep partner, "Hello World!" has been around. I remember writing it on a DEC PDP-11 the size of a refrigerator. Then it was C, simple and fast.

main()
{
  printf("Hello World!");
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.