上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: #include <iostream> using namespace std; int main() { int n,a=-1,b=-1,c=-1; cin>>n; if(n>0) { a=n%10; n=n/10; if(n>0) { b=n%10; n=n/10; } if(n>0) { c= 阅读全文
posted @ 2020-01-20 17:11 QRain 阅读(109) 评论(0) 推荐(0)
摘要: memset(mark,-1,sizeof(mark));对每个输入的数,将它所包含的数标志置1,本身标志置0.最后输出所有标志为0的数。 #include <iostream> using namespace std; int main() { int k,flag=0; cin>>k; int 阅读全文
posted @ 2020-01-20 17:04 QRain 阅读(174) 评论(0) 推荐(0)
摘要: 结构体数组的定义和使用 struct STU { char sname[10]; char sno[10]; int grade; }; struct STU stu[101]; #include <iostream> using namespace std; struct STU { char s 阅读全文
posted @ 2020-01-20 12:08 QRain 阅读(145) 评论(0) 推荐(0)
摘要: '\0' : 字符串结束标识符,也是空字符,ascii码为00 APAT-YES APAATA-NO,因为c为空字符,即字符串结束。 APAATAA-NO #include <iostream> using namespace std; int main() { int n,i; int sign 阅读全文
posted @ 2020-01-20 11:46 QRain 阅读(153) 评论(0) 推荐(0)
摘要: #include <iostream> #include <cstring> using namespace std; int main() { char num[101]; char out[11][10] = {"ling","yi","er","san","si","wu","liu","qi 阅读全文
posted @ 2020-01-20 10:12 QRain 阅读(100) 评论(0) 推荐(0)
摘要: #include <iostream> using namespace std; int main() { int n,step=0; cin>>n; while(n!=1) { if(n%2==0) n=n/2; else n=(3*n+1)/2; step++; } cout<<step<<en 阅读全文
posted @ 2020-01-17 15:59 QRain 阅读(139) 评论(0) 推荐(0)
摘要: 代码 #include <iostream> #include <string.h> using namespace std; int main() { int num = -1; int w=-1; char ISBN[14]; cin>>ISBN; num = (ISBN[0]-48)*1+(I 阅读全文
posted @ 2019-11-18 09:46 QRain 阅读(171) 评论(0) 推荐(0)
摘要: 代码 #include <iostream> using namespace std; int main() { int n,max=0,max_num=0; int *array = new int[1000]; cin>>n; for(int i=0;i<n;i++) cin>>array[i] 阅读全文
posted @ 2019-11-18 09:21 QRain 阅读(130) 评论(0) 推荐(0)
摘要: 1. 动态定义一维数组:int * data = new int[size] 2. 动态定义二维数组: int **data2; data2 = new int *[row]; for (i=0; i<row; i++) data2[i] = new int[col]; 阅读全文
posted @ 2019-09-03 09:43 QRain 阅读(2378) 评论(0) 推荐(0)
摘要: 四舍五入:保留整数 int a = b+0.5; 保留一位小数 int a=(b+0.05)*10; double c=a/10; 保留二位小数 int a=(b+0.005)*100; double c=a/100; (上面的方法仅适用于正数。) 如果需要对负数进行转换,可以为这个负数加上一个足够 阅读全文
posted @ 2019-09-03 09:25 QRain 阅读(4140) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 下一页