摘要: 硬核!C语言八大排序算法,附动图和详细代码解释! 程序人生 今天 前言 如果说各种编程语言是程序员的招式,那么数据结构和算法就相当于程序员的内功。想写出精炼、优秀的代码,不通过不断的锤炼,是很难做到的。 八大排序算法 排序算法作为数据结构的重要部分,系统地学习一下是很有必要的。 1、排序的概念 排序 阅读全文
posted @ 2020-01-27 17:34 bobo哥 阅读(1224) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream> #include<iomanip> #include<string> using namespace std; string Months[13] = { "","Jan","Feb","Mar","Apr","May","Jun","Jul","Au 阅读全文
posted @ 2020-01-27 15:26 bobo哥 阅读(168) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream> using namespace std; int main() { char str[30]; while (!cin.eof()) //当输入流没有结束时继续循环 { cin.ignore(10, ':'); //在cin流中跳过':'之前的全部字符 阅读全文
posted @ 2020-01-27 15:16 bobo哥 阅读(130) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream> using namespace std; int main() { char buf[10]; int i = 0; while (cin.getline(buf, 10)) //若输入流的一行超过9个字符,则会出错 cout << ++i << ": 阅读全文
posted @ 2020-01-27 15:10 bobo哥 阅读(129) 评论(0) 推荐(0)
摘要: 源程序: // // main.cpp // p292 // // Created by duanqibo on 2020/1/27. // Copyright © 2020年 duanqibo. All rights reserved. // #include<iostream> using na 阅读全文
posted @ 2020-01-27 14:59 bobo哥 阅读(127) 评论(0) 推荐(0)
摘要: 源程序: //程序7-10 #include <iostream> using namespace std; int main() { char c = 'a', str[80] = "0123456789abcdefghijklmn"; int x = 65; cout << "cout.put( 阅读全文
posted @ 2020-01-27 14:45 bobo哥 阅读(134) 评论(0) 推荐(0)
摘要: 源程序: //程序7-9 #include <iostream> using namespace std; int main() { double values[] = { 1.23,20.3456,300.4567,4000.56789,50000.1234567 }; cout.fill('*' 阅读全文
posted @ 2020-01-27 14:42 bobo哥 阅读(152) 评论(0) 推荐(0)
摘要: 源程序: //程序7-8 #include <iostream> #include <iomanip> using namespace std; int main() { double x = 12.34; cout << "1)" << setiosflags(ios::scientific | 阅读全文
posted @ 2020-01-27 14:38 bobo哥 阅读(156) 评论(0) 推荐(0)
摘要: 源程序: // // main.cpp // p286 // // Created by duanqibo on 2020/1/27. // Copyright © 2020年 duanqibo. All rights reserved. // //程序7-7 #include <iostream> 阅读全文
posted @ 2020-01-27 14:34 bobo哥 阅读(218) 评论(0) 推荐(0)
摘要: 源程序: // // main.cpp // p285 // // Created by duanqibo on 2020/1/27. // Copyright © 2020年 duanqibo. All rights reserved. // //程序7-6 #include<iostream> 阅读全文
posted @ 2020-01-27 14:25 bobo哥 阅读(135) 评论(0) 推荐(0)
摘要: 源程序: #include<iostream> #include<iomanip> using namespace std; int main() { int n = 65535,m = 20; cout<<"1)"<<n<<"n"<<"="<<hex<<n<<"="<<oct<<n<<endl; 阅读全文
posted @ 2020-01-27 14:21 bobo哥 阅读(116) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream> #include <string> using namespace std; int main() { char ch; int sum = 0,count = 0,x; cout<<"请输入整数(按Ctrl+Z退出)"<<endl; do { wh 阅读全文
posted @ 2020-01-27 14:15 bobo哥 阅读(112) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream> using namespace std; int main() { int x, count, sum = 0; freopen("c:\\input.txt", "r", stdin); for (count = 0; count<10; coun 阅读全文
posted @ 2020-01-27 12:44 bobo哥 阅读(104) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream> using namespace std; int main() { int x, count, sum = 0; freopen("c:\\input.txt", "r", stdin); //将标准输入重定向到文件input.txt for (co 阅读全文
posted @ 2020-01-27 12:37 bobo哥 阅读(160) 评论(0) 推荐(0)
摘要: 源程序: #include <iostream> using namespace std; int main() { int x, y; cin >> x >> y; freopen("c:\\test.txt", "w", stdout); if (y == 0) cerr<<"error."<< 阅读全文
posted @ 2020-01-27 12:09 bobo哥 阅读(114) 评论(0) 推荐(0)