hmmm很基本的例子~我也来一个c++
#include<iostream.h>
void main()
{
int num1, num2, sum; (这些是程式里要用到的variable)
cout<<" Please enter the 1st number:"<<endl; (显示Please.......并要求使用者输入第一个数目)
cin<<num1; (接收输入1)
cout<<" Please enter the 2nd number:"<<endl;(显示Please.......并要求使用者输入第2个数目)
cin<<num2; (接收输入2)
sum=num1+num2; (算式)
cout<<"The addiction for the both number u entered is "<<sum<<endl; (显示答案)
cout<<""<<endl;
}
我写的这个是初学者基本中的基本~超级简单的
如果你看不懂的话...真的是0罗~
注: 显示出来的会是这样~请想象背景是黑色
Please enter the 1st number:
_ (假设输入2)
输入后进入下面
Please enter the 2nd number:
_ (假设输入5)
输入后进入下面
(算式会将第一个数字和第二个数字加起来所以是7)
The addiction for the both bumber u entered is 7
press any key to continue_
过了上面就会跳出程式
[
本帖最后由 丧送狂曲 于 2009-2-6 01:28 AM 编辑 ]