【CPP Training】Getting Started with C++ PA
2013-04-13 02:43
405 查看
培训内容简要回顾
1)学习C++之前需要思考的内容
a)什么是编程
b)有效的学习方式(思考、阅读、试验)
2)C++的诞生与特点
http://www.research.att.com/~bs/
3)C++程序的基本结构
a)最基本的代码
b)创建源代码文件
c)编译和链接
4)C++能够做什么
a)C++标准I/O库的学习
b)string类以及标准模板库(STL)的学习
c)C++泛型算法库的学习
参考资料
1)Standard C++ Library Reference
http://www.cplusplus.com/reference/
2)Third Party Library Reference
http://en.cppreference.com/w/cpp/links/libs
http://www.trumphurst.com/cpplibs/cpplibs.php
编程练习题目
程序的输入
一种实现的方式
基于上述实现程序的输出
1)学习C++之前需要思考的内容
a)什么是编程
b)有效的学习方式(思考、阅读、试验)
2)C++的诞生与特点
http://www.research.att.com/~bs/
3)C++程序的基本结构
a)最基本的代码
b)创建源代码文件
c)编译和链接
4)C++能够做什么
a)C++标准I/O库的学习
b)string类以及标准模板库(STL)的学习
c)C++泛型算法库的学习
参考资料
1)Standard C++ Library Reference
http://www.cplusplus.com/reference/
2)Third Party Library Reference
http://en.cppreference.com/w/cpp/links/libs
http://www.trumphurst.com/cpplibs/cpplibs.php
编程练习题目
程序的输入
GUOHONGYUN LICHAO XIAYUZHE POSONG LIUBO LEIYU ZHANGCANGJU XIANGKAILIN HUANGHAO ZHUJIAJUN ZHONGCHENG LEIJUNAN YANGBO WEIWEI LIUTINGWEI OUYANGYU ZHANGZHENG ZHANGXINHAO HOUTINGWU KONGQIAO SIXU ZHANGJINJING YANJUNHUA HUANGRUI
一种实现的方式
#include <iostream> #include <fstream> #include <string> #include <vector> #include <algorithm> int main() { // Open the file "Names.txt" for input std::ifstream inFile( "Names.txt" ); std::vector<std::string> vecNames; // If the file is opened, then read all the names line by line if ( inFile.is_open() ) { std::string szName; // If the end of the file is reached, the loop will stop while ( inFile >> szName ) { vecNames.push_back( szName ); } } // Sort the name in ascending order, and you may // implement your own sorting algorithm as well std::sort( vecNames.begin(), vecNames.end() ); // Open the file "NameSorted.txt" for output std::ofstream outFile( "NameSorted.txt" ); // If the file is opened, then output the sorted names if ( outFile.is_open() ) { for ( int i = 0; i < vecNames.size(); i++ ) { outFile << vecNames[i]; // At most five names per row if ( 0 == ( i + 1 ) % 5 ) { outFile << std::endl; } else { outFile << " "; } } } // Get a character from console preventing the immediate exit of the program std::cin.get(); return 0; }
基于上述实现程序的输出
GUOHONGYUN HOUTINGWU HUANGHAO HUANGRUI KONGQIAO LEIJUNAN LEIYU LICHAO LIUBO LIUTINGWEI OUYANGYU POSONG SIXU WEIWEI XIANGKAILIN XIAYUZHE YANGBO YANJUNHUA ZHANGCANGJU ZHANGJINJING ZHANGXINHAO ZHANGZHENG ZHONGCHENG ZHUJIAJUN
相关文章推荐
- Getting Started with C++ in Visual Studio
- 【OpenMesh】Training:Getting Started with OpenMesh
- iOS 9: Getting Started With SFSafariViewController
- error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
- [Eclipse] Getting started with Eclipse plug-ins: creating extension points
- 2 Getting Started with Data Guard
- Getting Started with Kinect and Processing
- Getting Started with Core Data
- Getting Started with Apache Geode
- Advanced Android: Getting Started with the NDK
- [转]Getting Started with ASP.NET Web API 2 (C#)
- Getting started with aspnet5 and visualstudio code on a mac or linux
- Getting started with ASP.NET CORE
- 【TensorFlow官网搬运201704】Getting Started With TensorFlow
- 第五篇 Getting Started with ORACLE EBS(开始学习ORACLE EBS)
- Getting Started with Lync 2010 Model API
- 【干货】一篇文章学会Gulp(Getting started with Gulp)
- 【CPP Training】Data Abstraction and Hiding the Implementation PA
- getting started with laravel 4!chapter 3 Your First Application翻译
- [转载]Getting Started with ASP.NET vNext and Visual Studio 14