主题
最后登录1970-1-1
回帖0
精华
积分110
威望
RP
金钱 柯币
人气 ℃
注册时间2003-10-14
|
发表于 2004-9-16 10:25:43
|
显示全部楼层
回复: C++编程的小问题- -0
[QUOTE=shxyfan]这是第2个...
// Engg 233 Lab1
// File lab1_32.cc
// Author: I. Couloigner, aka Dr.C
// Created: July 21, 2004
// Topic: converts feet, inches in centimetres (1 inch = 2.54 cm)
#include <iostream>
using namespace std;
// main program
int main()
{
// declaration of variables
// input variables
int feet, inch;
// temporary variable
int inches;
// output variable
double cm;
// input from user
cout << "Please enter your data: ";
cout << "\n\t feet = ";
cin >> feet;
cout << "\t inch = ";
cin>> inch
// computes total number of inches
tot_inches = inch + feet*12;
// conversion into centimetres
cm = inch * 2.54;
// display result
cout << "\n" << feet << " feet and " << inch << " inches are equal to "
<< cm << " cm.\n" << endl;
return 0;
}[/QUOTE]
cin>> inch
少分号。
cin>> inch; |
|