cpp6.1
来源:互联网 发布:淘宝亲宝贝什么意思 编辑:程序博客网 时间:2024/06/05 21:05
6.1
#include<iostream>int main(){using std::cin;using std::cout;char ch;int spaces = 0;int total = 0;cin.get(ch);while (ch != '.'){if (ch == ' ')++spaces;++total;cin.get(ch);}cout << spaces << " spaces, " << total;cout << " characters tatal in sentence\n";system("pause");return 0;}
6.2
#include<iostream>int main(){char ch;std::cout << "Type, and I shall repeat. \n";std::cin.get(ch);while (ch!='.'){if (ch == '\n')std::cout << ch;elsestd::cout << ++ch;std::cin.get(ch);}std::cout << "\nplease excuse the slight confusion.\n";system("pause");return 0;}
6.3
#include<iostream>const int Fave = 27;int main(){using namespace std;int n;cout << "Enter a number in the range 1-100 to find ";cout << "My favorite number: ";do{cin >> n;if (n < Fave)cout << "Too low--guess again: ";else if (n > Fave)cout << "Too high--guess again: ";elsecout << Fave << " is right!\n";} while (n != Fave);system("pause");return 0;}
0 0
- cpp6.1
- cpp6.4
- cpp6.8
- 1
- 1
- 1
- 1
- 1
- 1
- 1》
- 1
- 1
- 1
- 1
- (1)
- 1
- 1
- 1
- window.location属性的应用
- HDU 4739 Zhuge Liang's Mines
- 一篇好文,以在迷茫时阅读
- ES6基本语法学习笔记--let与const
- Spring Boot (二)集成Mybatis、Druid
- cpp6.1
- java(12)------static关键字
- js 执行字符串函数名
- Mybatis学习笔记二:以接口方式编程
- 围绕中心旋转动画效果
- Keil(MDK-ARM)系列教程(五)_Configuration(Ⅰ)
- Struts2文件(图片)上传及页面显示
- 在Ubuntu16.04上安装Aegisub
- 图片无损压缩网址