cpp 7.9
来源:互联网 发布:windows登录界面壁纸 编辑:程序博客网 时间:2024/06/06 20:48
7.9
#include<iostream>unsigned int c_in_str(const char*str, char ch);int main(){using namespace std;char mmm[15] = "minimum";char*wail = "ululate";unsigned int ms = c_in_str(mmm, 'm');unsigned int us = c_in_str(wail, 'u');cout << ms << " m characters in " << mmm << endl;cout << us << "u characters in " << wail << endl;system("pause");return 0;}unsigned int c_in_str(const char*str, char ch){unsigned int count = 0;while (*str){if (*str == ch)count++;str++;}return count;}
7.10
#include<iostream>char*buildstr(char c, int n);int main(){using namespace std;int times;char ch;cout << "Enter a character: ";cin >> ch;cout << "Enter an integer: ";cin >> times;char *ps = buildstr(ch, times);cout << ps << endl;delete[]ps;ps = buildstr('+', 20);cout << ps << "-DONE-" << ps << endl;delete[]ps;system("pause");return 0;}char*buildstr(char c, int n){char*pstr = new char[n + 1];pstr[n] = '\0';while (n-- > 0)pstr[n] = c;return pstr;}
0 0
- cpp 7.9
- cpp
- CPP
- CPP
- cpp
- cpp
- CPP
- CPP
- ClientSockThread.cpp&&ClientUrlThread.cpp
- cpp调用其他cpp
- ex34a.cpp&&ex34aDoc.cpp&&ex34aView.cpp
- MainFrm.cpp&&ServerThread.cpp&&SheetConfig.cpp
- CPP thread
- cpp->html
- CFaderWnd.cpp
- PasswordReminder.cpp
- object.cpp
- CmdTarget.cpp
- display:none与visible:hidden的区别
- 圈复杂度的计算
- Android性能优化之内存篇
- android LayerDrawable转Drawable
- 快速关闭cmd窗口
- cpp 7.9
- 从高版本JDK换成低版本JDK报错Unsupported major.minor version 52.0
- (原) Bootstrap 可视化HTML编辑器,summernote 图片上传到服务器磁盘
- 序
- Ubuntu 16.04 L2pt
- Hadoop基础学习(一)
- NAND FLASH读写速度计算方法详解
- RecyclerView的万能Adapter和ViewHolder
- 把C++类成员方法直接作为线程回调函数