又整理一份2002年初学C++时的代码,供初学C++的朋友学习

      计算机与编程 2007-4-25 10:09:00

//2002.8.28 for 50+...100,cycle sum it

#include <iostream.h>

main()

{
cout<<"this programme will add A,B,C,D to cycle add."<<endl;
cout<<"now please input the A.value: "<<endl;
long int A,B,C,D;
cin>>A;
cout<<"now please input the B.value: "<<endl;
cin>>B;
cout<<"now please input the C.value: "<<endl;
cin>>C;
cout<<"now please input the D.value: "<<endl;
cin>>D;

long int X=0;
for (long int i=A;i<=B;++i)
X=X+i;

long int Y=0;
for (long int j=C;j<=D;++j)
Y=Y+j;

cout<<"the cycle of A and B is: "<<X<<endl;
cout<<"the cycle of C and D is: "<<Y<<endl;

cout<<"the sum of X and Y is: "<<X+Y<<endl;
cout<<"the i is: "<<i<<endl;
cout<<"the j is: "<<j<<endl;

cout<<"have you seen the all result?"<<endl;
char BB;
cin>>BB;
cout<<"byebye!"<<endl;


}

标签集:TAGS:
回复Comments() 点击Count()
喜欢就顶一下

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}