![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 53
yufengzheyang
这个作者很懒,什么都没留下…
展开
-
解决C++编译出现的重定义问题:multiple definition of ’XXX‘错误
1 //file_NO2:hello.cpp 2 #include 3 #include"hello.h" 4 using namespace std; 5 hello::hello() 6 { 7 } 8 9 int hello::Display() 10 { 11 cout<<"Hello, World!\n"<<endl; 12 ret原创 2015-09-28 09:57:43 · 23023 阅读 · 1 评论 -
Ubuntu下面的一个简单的C++程序——My first C++ demo in Linux
现在Linux终端下面用vim编辑器写一个hello.cpp文件 vim hello.cpp 然后再按下键盘的”i“键,表示insert的意思,接着就可以在hello.cpp文件中写入以下文件了: 1 #include 2 using namespace std; 3 int main() 4 { 5 cout<<"Hello world!\n"原创 2015-09-28 10:21:41 · 595 阅读 · 0 评论 -
利用makefile文件来编译C++
1 //file_NO1:hello.cpp 2 #include 3 #include"hello.h" 4 using namespace std; 5 hello::hello() 6 { 7 } 8 9 int hello::Display() 10 { 11 cout<<"Hello, World!\n"<<endl; 12 ret原创 2015-09-28 10:59:40 · 835 阅读 · 0 评论 -
一个简单的两数求和程序的小小改动
今天在实现课本上的求两数之和的程序时,发现这个程序并不是很人性化,于是乎做了一点小改动,呵呵,仅此而已。 课本上的求两数之和的程序写得很简洁: 1 //求a和b两个数之和 2 //求两数之和 3 #include 4 using namespace std; 5 int main() 6 { 7 int a,b,sum; 8 9原创 2015-09-29 10:36:24 · 1655 阅读 · 0 评论 -
一个包含类(class)和对象(object)的简单程序
对这个程序不太了解,感觉类的声明有些怪,定义公有函数display()时,最后怎么有个分号呢?这个问题先放一放,以后应该会弄懂的。 #include using namespace std; class Student //声明一个类,类名为Student { private: //以下为类中的私有部分 int num;原创 2015-09-30 10:41:40 · 943 阅读 · 0 评论