2018年11月14日
摘要: void decto16 (int a, char c[]) { // a为要转换的十进制数 将结果存放在数组c中 ,以数组形式输出 int y; int k = 0; do { y = a % 16; a = a / 16; for (int i = 0; i <= 9; i++) { if (y 阅读全文
posted @ 2018-11-14 22:09 likeghee 阅读(2879) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std; int k = 0;int n = 0;int main() { char c; char a[1000]; do { cin.get(c); if(c>='A'&&c<='Z'){ //将大写转换为小写 c=c+32; 阅读全文
posted @ 2018-11-14 21:27 likeghee 阅读(918) 评论(0) 推荐(0) 编辑
摘要: int numwords(char a [] ){ int i ,j ,num = 0 ; for ( i = 0 , j = strlen (a) ; i<j;){ //遍历a字符串 while(a[i] == ' ') i++ ; //遇到空格时 跳过 if(i<j) num++; //跳过空格 阅读全文
posted @ 2018-11-14 09:53 likeghee 阅读(247) 评论(0) 推荐(0) 编辑
摘要: void xxx (int **a, int r . int c){ // r代表行 , c代表列 //在转变后的函数中,array[i][j]这样的式子是不对的,因为编译器不能正确的为它寻址,所以我们需要模仿编译器的行为把array[i][j]这样的式子手工转变为 ((int *)a + c * 阅读全文
posted @ 2018-11-14 08:46 likeghee 阅读(510) 评论(0) 推荐(0) 编辑
  2018年11月8日
摘要: // test4.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。// #include "pch.h"#include <iostream>#include <cmath>using namespace std; int quanz[17] = { 7,9,10,5,8,4 阅读全文
posted @ 2018-11-08 00:17 likeghee 阅读(14003) 评论(0) 推荐(0) 编辑
  2018年11月4日
摘要: 这代码写的真的是越写越冗长 无力吐槽 #include <iostream> using namespace std; void tran_dayu0_b_hex(int x)//转换函数1 { if (x > 0) { static int a[1000]; static int cal = 0; 阅读全文
posted @ 2018-11-04 22:51 likeghee 阅读(2831) 评论(0) 推荐(0) 编辑
  2018年10月24日
摘要: 代码如下: (拓展)统计26个字母在一篇新闻中各自出现的频率。 代码如下: } (拓展)英文新闻由文件输入,统计其中a-z这26个字母各出现的次数和总字符个数。(不区分大小写) 总结:for循环处理ch=cin.get(); 解决了enter结束输入流的问题。分别用if判断是什么字符或者#结束。 - 阅读全文
posted @ 2018-10-24 21:41 likeghee 阅读(3803) 评论(0) 推荐(0) 编辑
摘要: count函数 algorithm头文件(#include <algorithm>)定义了一个count的函数,其功能类似于find。这个函数使用一对迭代器和一个值做参数,返回这个值出现次数的统计结果。 编写程序读取一系列int型数据,并将它们存储到vector对象中,然后统计某个指定的值出现了多少 阅读全文
posted @ 2018-10-24 21:32 likeghee 阅读(2157) 评论(0) 推荐(0) 编辑
  2018年10月10日
摘要: 本题要求根据火车的出发时间和达到时间,编写程序计算整个旅途所用的时间。 输入格式: 输入在一行中给出2个4位正整数,其间以空格分隔,分别表示火车的出发时间和到达时间。每个时间的格式为2位小时数(00-23)和2位分钟数(00-59),假设出发和到达在同一天内。 输出格式: 在一行输出该旅途所用的时间 阅读全文
posted @ 2018-10-10 13:14 likeghee 阅读(1375) 评论(0) 推荐(0) 编辑