C++实验一
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++实验一的更多相关文章
- [原] 利用 OVS 建立 VxLAN 虚拟网络实验
OVS 配置 VxLAN HOST A ------------------------------------------ | zh-veth0(10.1.1.1) VM A | | ---|--- ...
- Android中Activity的四大启动模式实验简述
作为Android四大组件之一,Activity可以说是最基本也是最常见的组件,它提供了一个显示界面,从而实现与用户的交互,作为初学者,必须熟练掌握.今天我们就来通过实验演示,来帮助大家理解Activ ...
- SEED实验系列文章目录
美国雪城大学SEEDLabs实验列表 SEEDLabs是一套完整的信息安全实验,涵盖本科信息安全教学中的大部分基本原理.项目组2002年由杜文亮教授创建,目前开发了30个实验,几百所大学已采用.实验楼 ...
- 物联网实验4 alljoyn物联网实验之手机局域网控制设备
AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...
- (转)linux下和云端通讯的例程, ubuntu和openwrt实验成功(一)
一. HTTP请求的数据流总结#上传数据, yeelink的数据流如下POST /v1.0/device/4420/sensor/9089/datapoints HTTP/1.1Host: api. ...
- (原创) alljoyn物联网实验之手机局域网控制设备
AllJoyn开源物联网协议框架,官方描述是一个能够使连接设备之间进行互操作的通用软件框架和系统服务核心集,也是一个跨制造商来创建动态近端网络的软件应用.高通已经将该项目捐赠给了一个名为“AllSee ...
- 实验:Oracle直接拷贝物理存储文件迁移
实验目的:Oracle直接拷贝物理文件迁移,生产库有类似施工需求,故在实验环境简单验证一下. 实验环境: A主机:192.168.1.200 Solaris10 + Oracle 11.2.0.1 B ...
- Oracle RAC 更换存储实验
实验环境准备: RHEL 6.5 + Oracle 11.2.0.4 RAC (2nodes) OCR和Voting Disk使用的是OCR1磁盘组,底层对应3个1G大小的共享LUN,一般冗余: DA ...
- Vertica集群扩容实验过程记录
需求: 将3个节点的Vertica集群扩容,额外增加3个节点,即扩展到6个节点的Vertica集群. 实验环境: RHEL 6.5 + Vertica 7.2.2-2 步骤: 1.三节点Vertica ...
- 数据库---实验四 oracle的安全性和完整性控制
实验内容: (一) 授权 . 以dba用户的身份登陆oracle,创建用户u1+学号后四位,u2+学号后四位. SQL> create user u1_3985 identified by &q ...
随机推荐
- Command "python setup.py egg_info" failed with error code 1 in c:\users\w5659\appdata\local\temp\pip-build-fs2yzl\ipython\
Error Msg: Collecting ipython Using cached https://files.pythonhosted.org/packages/5b/e3/4b3082bd7f6 ...
- [第二届构建之法论坛] 预培训文档(C++版)
本博客是第二届构建之法论坛暨软件工程培训活动预培训文档中[适用于结对编程部分的C++版本],需要实验者有一部分C++基础. 目录 Part0.背景 Part1.配置环境 Part2.克隆项目 Part ...
- openstack搭建之-nova配置(10)
一. base节点设置数据库 mysql -u root -proot CREATE DATABASE nova_api; CREATE DATABASE nova; CREATE DATABASE ...
- Spring 使用AOP——xml配置
目录 AOP介绍 Spring进行2种实现AOP的方式 导入jar包 基于schema-based方式实现AOP 创建前置通知 创建后置通知 修改Spring配置文件 基于schema-based方式 ...
- springboot 打war
pom.xml <packaging>war</packaging> <!-- 打包设置 --> <plugins> <plugin> &l ...
- mybatis 中的 update 返回值你真的明白吗
记录源地址:https://www.jianshu.com/p/80270b93082a
- Windows Server 2016激活方法+密钥+遇到的问题及解决办法(摘抄)
Windows Server 2016激活方法+密钥+遇到的问题及解决办法 2018年08月30日 13:47:34 Brozer 阅读数:28667 这两天公司准备部署Revit Server ...
- 使用ServletContext对象读取资源文件
备注:本文以properties文件为例 一.通过ServletContext读取文件 1.通过ServletContext读取放置在src下的properties文件 package com; im ...
- rt-thread 之网络组件
@2019-02-23 [小记] 文件 <net_sockets.c> 为兼容标准 BSD Socket API 文件 <sal_socket.c> 为网络中间抽象层 文件 & ...
- Time travel HDU - 4418(高斯消元)
Agent K is one of the greatest agents in a secret organization called Men in Black. Once he needs to ...