2-28

#include <iostream>
using namespace std;
int main()
{char x;
cout<<"Menu: A(dd) D(elete) S(ort) Q(uit),Select one:"<<endl;
cin>>x;
while(x)
{if (x=='A')
{cout<<"Date add"<<endl;
}
else
if (x=='D')
{cout<<"Date delete"<<endl;
}
else
if (x=='S')
{cout<<"Date sort"<<endl;
}
else if(x=='Q')
break;
else cout<<"Date error"<<endl;
cout<<"Menu: A(dd) D(elete) S(ort) Q(uit),Select one:"<<endl;
cin>>x;
}
return ;
}

(1)

#include <iostream>
using namespace std;
int main()
{char x;
cout<<"Menu: A(dd) D(elete) S(ort) Q(uit),Select one:"<<endl;
cin>>x;
while(x)
{switch(x)
{case 'A':
cout<<"Date add"<<endl;
break;
case 'D':
cout<<"Date delete"<<endl;
break;
case 'S':
cout<<"Date sort"<<endl;
break;
default:
cout<<"Date quit"<<endl; }
if(x=='Q')
break;
cout<<"Menu: A(dd) D(elete) S(ort) Q(uit),Select one:"<<endl;
cin>>x;
}
return ;
}

(2)

2-29

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int t = , i, j = , flag;
while (j < )
{
flag = ;
i = ;
while (i <= j - )
{
if (j%i++ == )
{
flag = ;
break;
}
}
if (flag == )
{
t++;
cout << setw()<<j ;
if (t % == )
cout << endl;
}
j++;
}
return ;
}

(1)

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int t = , i, j = , flag;
do
{
flag = ;
i = ;
while (i <= j - )
{
if (j%i++== )
{
flag = ;
break;
}
}
if (flag == )
{
t++;
cout << setw() << j;
if (t % == )
cout << endl;
}
j++;
}while (j < );
return ;
}

(2)

#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int t = , i, j = , flag;
for (;j < ;j++)
{
flag = ;
i = ;
for (;i <= j - ;i++)
{
if (j%i== )
{
flag = ;
break;
}
}
if (flag == )
{
t++;
cout << setw() << j;
if (t % == )
cout << endl;
}
}
return ;
}

(3)

2-32

#include <iostream>
using namespace std;
int main()
{int i=, j;
cin >> j;
while (i != j)
{
if (j > i)
cout << "bigger than the number" << endl;
if (j < i)
cout << "lower than the number" << endl;
cin >> j;
}
cout <<"Congratulations!You guess it."<< endl;
return ;
}

(1)

#include <iostream>
using namespace std;
int main()
{
int i = , j;
cin >> j;
do
{
if (j > i)
cout << "bigger than the number" << endl;
if (j < i)
cout << "lower than the number" << endl;
cin >> j;
}while (i != j);
cout << "Congratulations!You guess it." << endl;
return ;
}

(2)

2-34

#include<iostream>
using namespace std;
int main()
{int a, b, c;
cout << "red:0,yellow:1,blue:2,white:3,black:4"<<endl;
for (a = ;a < ;a++)
{
for (b = a + ;b < ; b++)
{
if (a == b) continue;
for (c = b + ;c < ;c++)
{
if (c == a || c == b) continue;
cout << a << b << c << endl;
}
}
}
return ;
}

(0)

总结:要好好学习,加油鸭~

https://www.cnblogs.com/syf1/p/10561928.html

https://www.cnblogs.com/fearless04/p/10543040.html

https://www.cnblogs.com/Yyaoyyy/p/10547742.html

C++实验一的更多相关文章

  1. [原] 利用 OVS 建立 VxLAN 虚拟网络实验

    OVS 配置 VxLAN HOST A ------------------------------------------ | zh-veth0(10.1.1.1) VM A | | ---|--- ...

  2. Android中Activity的四大启动模式实验简述

    作为Android四大组件之一,Activity可以说是最基本也是最常见的组件,它提供了一个显示界面,从而实现与用户的交互,作为初学者,必须熟练掌握.今天我们就来通过实验演示,来帮助大家理解Activ ...

  3. SEED实验系列文章目录

    美国雪城大学SEEDLabs实验列表 SEEDLabs是一套完整的信息安全实验,涵盖本科信息安全教学中的大部分基本原理.项目组2002年由杜文亮教授创建,目前开发了30个实验,几百所大学已采用.实验楼 ...

  4. 物联网实验4 alljoyn物联网实验之手机局域网控制设备

    AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...

  5. (转)linux下和云端通讯的例程, ubuntu和openwrt实验成功(一)

    一.  HTTP请求的数据流总结#上传数据, yeelink的数据流如下POST /v1.0/device/4420/sensor/9089/datapoints HTTP/1.1Host: api. ...

  6. (原创) alljoyn物联网实验之手机局域网控制设备

    AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...

  7. 实验:Oracle直接拷贝物理存储文件迁移

    实验目的:Oracle直接拷贝物理文件迁移,生产库有类似施工需求,故在实验环境简单验证一下. 实验环境: A主机:192.168.1.200 Solaris10 + Oracle 11.2.0.1 B ...

  8. Oracle RAC 更换存储实验

    实验环境准备: RHEL 6.5 + Oracle 11.2.0.4 RAC (2nodes) OCR和Voting Disk使用的是OCR1磁盘组,底层对应3个1G大小的共享LUN,一般冗余: DA ...

  9. Vertica集群扩容实验过程记录

    需求: 将3个节点的Vertica集群扩容,额外增加3个节点,即扩展到6个节点的Vertica集群. 实验环境: RHEL 6.5 + Vertica 7.2.2-2 步骤: 1.三节点Vertica ...

  10. 数据库---实验四 oracle的安全性和完整性控制

    实验内容: (一) 授权 . 以dba用户的身份登陆oracle,创建用户u1+学号后四位,u2+学号后四位. SQL> create user u1_3985 identified by &q ...

随机推荐

  1. 使用埃拉托色尼筛选法(the Sieve of Eratosthenes)在一定范围内求素数及反素数(Emirp)

    Programming 1.3 In this problem, you'll be asked to find all the prime numbers from 1 to 1000. Prime ...

  2. ASP.NET下MVC设计模式的实现

    [转载]MVC架构在Asp.net中的应用和实现 转载自:http://www.cnblogs.com/baiye7223725/archive/2007/06/07/775390.aspx 摘要:本 ...

  3. CLOUD清理临时表空间

    --查找空间名.物理空间路径 SELECT name, physical_nameFROM sys.master_filesWHERE database_id = DB_ID('tempdb'); 可 ...

  4. fiddler抓包App数据

    在做手机或移动端APP的接口测试时,需要从开发人员那里获取接口文档,接口文档应该包括完整的功能接口.接口请求方式.接口请求URL.接口请求参数.接口返回参数.如果当前项目没有接口文档,则可以使用fid ...

  5. IO复用,AIO,BIO,NIO,同步,异步,阻塞和非阻塞 区别参考

    参考https://www.cnblogs.com/aspirant/p/6877350.html?utm_source=itdadao&utm_medium=referral IO复用,AI ...

  6. 2019-04-03 搭建Mybatis环境

    1. 配置pom.xml依赖 <dependency> <groupId>org.mybatis</groupId> <artifactId>mybat ...

  7. Git里有些费解的术语和设计

    关于暂存区, 好几个地方都写到了 正在编辑的文件 --> Unchacked/Modified, 而Unchacked/Modified, 的状态也可以叫 to be committed . 这 ...

  8. 洛谷 P1443 马的遍历

    终于遇到一个简单纯粹一点的bfs了...... 题目链接:https://www.luogu.org/problemnew/show/P1443 题目是求到达一个点的最短步数 也就是说我只要bfs遍历 ...

  9. 使用chrome开发者工具中的network面板测量网站网络性能

    前面的话 Chrome 开发者工具是一套内置于Google Chrome中的Web开发和调试工具,可用来对网站进行迭代.调试和分析.使用 Network 面板测量网站网络性能.本文将详细介绍chrom ...

  10. 线程池、进程池(concurrent.futures模块)和协程

    一.线程池 1.concurrent.futures模块 介绍 concurrent.futures模块提供了高度封装的异步调用接口 ThreadPoolExecutor:线程池,提供异步调用 Pro ...