Demonten
Newcomer
So I'm just starting to program, and I'm writing VERY simple conversion programs running out of console, and I'm curious as to how I could get it to output decimals, because 12 inches is not exactly 30 centimeters, it's 30.48 centimeters. I've got a bunch of these, but I'll use the inches to centimeters one for this post.
Code:
#include<cstdio>
#include<cstdlib>
#include<iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
int inch;
cout << "Enter the distance in inches:";
cin >> inch;
int cm;
cm = inch * 2.54;
cout << "Distance in centimeters:";
cout << cm << endl;
system("PAUSE");
return 0;
}

