第三周作业
来源:互联网 发布:mac开机显示问号文件夹 编辑:程序博客网 时间:2024/06/05 18:36
例题2.1
变化一:
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>#include <iomanip>using namespace std;int main(){bool flag = true;cout<<flag<< endl;cout<<boolalpha<<flag<< endl;cout<<flag + 8<< endl;flag = NULL;cout<<"执行语句 flag = 0;后flag的值为:"<<boolalpha << flag << endl;flag = 0.0;cout<<"执行语句 flag = 0.0;后flag的值为: "<<boolalpha << flag<< endl;return 0;}
变化二:
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>#include <iomanip>using namespace std;int main(){bool flag = true;cout<<flag<< endl;cout<<boolalpha<<flag<< endl;cout<<flag + 8<< endl;flag = 10;cout<<"执行语句 flag = 0;后flag的值为:"<<boolalpha << flag << endl;flag = 0.0;cout<<"执行语句 flag = 0.0;后flag的值为: "<<boolalpha << flag<< endl;return 0;}
例题2.2
变化一:
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){int a,b,c,d;a = 4;b = a;a = 5;c = d = 6; c = c * a;d = d % (a + b);cout<<"a = "<<a<<endl<<"b = "<<b<<endl<<"c = "<<c<<endl<<"d = "<<d<<endl;return 0;
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){int a,b,c,d;a = 4;b = a;a = 5;c = d = 6; c -= a;d *= (a + b);cout<<"a = "<<a<<endl<<"b = "<<b<<endl<<"c = "<<c<<endl<<"d = "<<d<<endl;return 0;
例题2.3
变化一:
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){long i,j,m,n;i=1000;j=1000;m=i+j;n=i*j;cout<<"m="<<m<<endl;cout<<"n="<<n<<endl;return 0;}
变化二:
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){short i,j,m,n;i=100;j=100;m=i+j;n=i*j;cout<<"m="<<m<<endl;cout<<"n="<<n<<endl;return 0;}
例题2.4
变化一:
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){ int i=6,j,k,temp;j=++i;k=i++;cout<<"i="<<i<<endl<<"j="<<j<<endl<<"k="<<k<<endl;return 0;}
变化二:
// 2323.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){ int i=6,j,k,temp;j=i--;k=--i;--i=2;cout<<"i="<<i<<endl<<"j="<<j<<endl<<"k="<<k<<endl;return 0;}
例题2.5
变化一:
// qwqwqwq.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){char ch;cout<<"plaese input a character:";cin>>ch;ch = ch>='a'&&ch<='z'?ch-'a'+'A':ch; cout<<"The result is:"<<ch<<endl;return 0;}
变化二:
// qwqwqwq.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include <iostream>using namespace std;int main(){char ch;cout<<"plaese input a character:";cin>>ch;ch = ch>='a'&&ch<='z'?ch-32:ch; cout<<"The result is:"<<ch<<endl;return 0;}
例题2.6
0 0
- 第三周作业
- 第三周作业 2
- 第三周作业 3
- 第三周作业 4
- 第三周作业
- 第三周作业
- 第三周作业
- 第三周作业
- 第三周作业
- 第三周作业
- c++第三周作业
- 作业(第三周)
- C++第三周作业
- 第三周C++作业
- 第三周作业
- 第三周作业
- 第三周作业
- 第三周作业
- 如果你是dj
- IOS 应用评论机制
- web性能测试基本性能指标
- 【转】[置顶] 女友的心酸考博路
- Zero Sum
- 第三周作业
- c++
- 分析C语言中函数调用
- 解决<dl-ssl.google.com> != <www.google.com>
- PHP imagick扩展使用心得
- linux常见命令
- viewpager+fragment 如何管理fragment
- JQuery里的原型prototype分析
- awk里面执行shell命令