正在加载图片...
( 3)#include <iostream.h> #include <iomanip. h> void mainO for(int Fl; k<=9; i++) < r(intr=l;i<=9;计++){ cout <<setw(3)<<i; if(i=I i-4)<""; for(int j=i; j<=9; j++) cout <<setw (4)<<i*j; cout <<end; 课本的第10题: #include <iostream.h> 0 l b=l c=l te cout << please input a value: n; cin >>n for(int i-4; K<=n; i++) b= cout <<c<<end; 7设计一个简单的计算器程序 #include <iostream.h> oid mainO char op; first number: cout<<Second number cIn>>y switch(op) t case+: cout<<endk<<< +<<y<<=<<x+y; break; x y; break;⑶ #include <iostream.h> #include <iomanip.h> void main() { cout <<" *"; for(int i=1; i<=9; i++) cout <<setw(4) <<i; cout <<"\n-----------------------------------------\n"; for(int i=1; i<=9; i++){ cout <<setw(3) <<i; if(i!=1) cout <<setw(4*i-4) <<" "; for(int j=i; j<=9; j++) cout <<setw(4) <<i*j; cout <<endl;} } 课本的第 10 题: #include <iostream.h> void main() { int n; long a=1, b=1, c=1, temp; cout <<"please input a value:\n"; cin >>n; for(int i=4; i<=n; i++){ temp=a+c; a=b; b=c; c=temp;} cout << c <<endl; } ⒎设计一个简单的计算器程序 #include <iostream.h> void main() {int x,y; char op; cout<<"first number:"; cin>>x; cout<<"Second number:"; cin>>y; cout<<"op:"; cin>>op; switch(op) { case'+': cout<<endl<<x<<"+"<<y<<"="<<x+y; break; case'-': cout<<endl<<x<<"-"<<y<<"="<<x-y;break; case'*': cout<<endl<<x<<"*"<<y<<"="<<x*y;break;
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有