学习 C++,关键是要理解概念,而不应过于深究语言的技术细节

学习 C++
学习 C++,关键是要理解概念,而不应过于深究语言的技术细节。

学习程序设计语言的目的是为了成为一个更好的程序员,也就是说,是为了能更有效率地设计和实现新系统,以及维护旧系统。

C++ 支持多种编程风格。您可以使用 Fortran、C、Smalltalk 等任意一种语言的编程风格来编写代码。每种风格都能有效地保证运行时间效率和空间效率。

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 class Student
 6 {
 7     private:
 8         int num;
 9         int score;
10     public:
11         void setdata()
12         {
13             cin>>num;
14             cin>>score;
15         }
16         void display()
17         {
18           cout <<"num="<<num<<endl;
19           cout <<"score="<<score<<endl;
20         };
21 };
22 
23 Student stud1,stud2;
24 int main(int argc, char** argv) {
25     
26     stud1.setdata();
27     stud2.setdata();
28     stud1.display();
29     stud2.display();
30     return 0;
31 }

猜你喜欢

转载自www.cnblogs.com/borter/p/9400716.html