C++基础学习笔记【B站黑马程序员】


一、基础知识

1.2注释

单行注释://

多行注释:/*.........*/

1.3变量

作用:给一段指定的内存空间起名,方便操作这段内存。

语法:数据类型 变量名 = 初始值;

1.4常量

方式一:#define 宏常量:#define 常量名 常量值

方式二:const修饰的变量也称为常量:const 数据类型 常量名 = 常量值;

             通常在变量定义前加关键字const,修饰该变量为常量,不可修改。

1.5关键字(标识符)

1.6标识符命名规则

  1. 标识符不能是关键字

  2. 只能由字母、数字、下划线组成

  3. 第一个字符必须为字符或下划线

  4. 标识符中字母区分大小写


二、数据类型

2.1整形

数据类型存在的意义:给变量分配合适的内存空间。

类型

占用字节

取值范围

范围

short

2字节

-2^15~2^15-1

-32768~32767

int

4

-2^31~2^31-1

long

Windows:4

Linux:4(32位)

           8(64位)

-2^31~2^31-1

long long

8

-2^63~2^63-1

2.2 sizeof关键字

作用:利用sizeof关键字可以统计数据类型所占内存大小

语法:sizeof(数据类型/变量)

2.3实型(浮点型)

默认情况下 输出一个小数,会显示出6位有效数字。

作用:用于表示小数

分类:单精度float、  双精度double

数据类型

占用空间

有效数字范围

float

4

7

double

8

15~16

2.4字符型

作用:字符型变量用于显示单个字符

用法:char ch = 'a';

          注意:在显示字符型变量时,用单引号将字符括起来,不要用双引号;且单引号内只能有一个字符,不可以是字符串。

        C和C++字符型变量占用1个字节

       字符型变量并不是把字符本身放到内存中存储,而是将对应的ASCll编码放到存储单元。

2.5转义字符

用于表示一些不能显示出来的ASCll字符

\n  换行

\t  水平制表:一个\t占用8个字节的位置,看你怎么分配了

\\  反斜线字符

2.6字符串型

作用:用于表示一串字符

方式一:C风格字符串:char 变量名[] = "字符串值"

方式二:C++风格字符串:string 变量名 = "字符串值",这个方式要加头文件:#include<string>

2.7布尔类型bool  【占用1个字节大小】

true = 1;false = 0

2.8数据的输入

作用:用于从键盘获取数据

关键字:cln???还是cin

语法:cln>>变量;


三、运算符

算术、幅值、比较、逻辑

3.1算术运算符

+、-、*、/、%取余、++前置/后置递增++a,a++

3.2赋值运算符

=、+=、-=、*=、/=、%=

3.3比较运算符

==、!=、<、>、<=、>=

3.4逻辑运算符

&&、||、!(与、或、非)


四、程序流程结构(顺序结构、选择结构、循环结构)

4.1选择结构

4.1.1 if语句

  • 单行格式if语句:

    if(条件){   语句  }
  • 多行格式if语句:

if(条件){
语句1}

else{

语句2};
  • 多条件格式的if语句:

if(条件1)

      { 语句1满足执行的语句}

else if(条件2)

       {条件2 满足执行的语句}

...

else{ 都不满足执行的语句 }
  • 嵌套if语句

4.1.2三目运算符

(表达式1?表达式2:表达式3)

4.1.3switch语句

switch(表达式)

{

    case 结果1:执行语句;break;

    case 结果2:执行语句;break;

     .....

    default:执行语句;break;

}

4.2循环结构

4.2.1while循环

while(循环条件)

   {

          循环语句

   }

##########随机数的添加

添加随机数种子,利用当前系统时间生成随机数,防止每次随机数都一样

需加头文件#include<ctime>

srand((unsigned int)time(NULL));

4.2.2 do...while循环语句

do{ 循环语句 }

while(循环条件);

与while循环的区别在于do...while会先执行一次循环语句,再判断循环条件

4.2.3 for循环语句

语法:

for(起始表达式;条件表达式;末尾循环体)   { 循环语句;}

4.2.4 嵌套循环

作用:在循环体中再嵌套一层循环,解决一些实际问题。

eg.乘法口诀表的代码实现:

#include<iostream>

using namespace std;

int main()

{  

       for (int i = 1; i < 10; i++)//j是行数

       {

               for (int j = 1; j <= i; j++)//j是行数//列数<=当前行数

               {

                      cout << j << "*" << i << "=" << i * j <<"    ";

               }

               cout<< endl;//换行操作

       }

       system("pause");

       return 0;

4.3 跳转语句

4.3.1 break语句

作用:用于跳出选择结构或者循环结构

使用环境:

  • 出现在switch语句中,作用是终止case并跳出switch

  • 出现在循环语句中,作用是跳出当前是的循环语句

  • 出现在嵌套语句中,跳出最近的内层循环语句。

4.3.2 continue语句

作用:在循环语句中,跳过本次循环中余下尚未执行的语句,继续执行下一次循环。

4.3.3 goto语句

作用:可以无条件跳转语句

语法:goto 标记;

解释:如果标记的名称存在,执行到goto语句时,会跳转到标记的位置。

五、数组

5.1特点:

数组中每个数据元素都是相同的数据类型/数组是由连续的内存位置组成的。

5.2 一维数组

5.2.1 一维数组定义的三种方式:

数据类型 数组名[ 数组长度 ];

数据类型 数组名[ 数组长度 ] = { 值1,值2,... };

数据类型 数组名[     ] = { 值1,值2,... };

5.2.2 一维数组的数组名

一维数组名称的用途:

  • 可以统计整个数组在内存中的长度

  • 可以获取数组在内存中的首地址

挑选最大值的代码:

int arr[5] = {300,350,200,400,250};

       int max = 0;

       for (int i = 0; i < 5; i++)

       {

               if (arr[i] > max)

               {

                      max = arr[i];

               }

       }

       cout << "最胖的小猪体重是: " << max << endl;

数组元素逆序的代码:

int main()

{  

       int arr[5] = {1,3,2,5,4};

       int temp = 0;

       int start = 0;

       int end = sizeof(arr) / sizeof(arr[0]) - 1;

       while (start < end)

       {   //实现元素互换

               temp = arr[start];

               arr[start] = arr[end];

               arr[end] = temp;

               //下标更新

               start++;

               end--;

       }

       cout << "逆序后的排列顺序为:" << endl;

       for (int j = 0; j < 5; j++)

       {

               cout << arr[j] << endl;

       }

       system("pause");

       return 0;

}

5.2.3 冒泡排序

原理:

  1. 比较相邻的元素。如果第一个比第二个大,就交换他们两个。

  2. 对每一个相邻元素做同样的工作,执行完毕后,找到第一个最大值。

  3. 重复以上的步骤,每次比较次数-1,直到不需要比较。

重点:排序轮数:元素个数-1

          内层循环对比次数 = 元素个数 - 当前轮数 - 1

利用冒泡排序实现升序序列:

int arr[9] = {4,2,8,0,5,7,1,3,9};

       //总共排序轮数为:元素个数-1

       for (int i = 0; i < 9 - 1; i++)

       {

               //内层循环对比 次数 = 元素个数-当前轮数-1

               for (int j = 0; j < 9 - i - 1; j++)

               {

                      //如果第一个数字比第二个数字大,则交换位置

                      if (arr[j] > arr[j + 1])

                      {

                              int temp = arr[j];

                              arr[j] = arr[j + 1];

                              arr[j + 1] = temp;

                      }

               }

       }

       cout << "排序后结果:" << endl;

       for (int i= 0; i < 9; i++)

       {

               cout << arr[i] << "   ";

       }

       cout << endl;//换行

5.3 二维数组

5.3.1 二维数组的四种定义方式

数据类型  数组名[  行数  ][  列数   ];

数据类型  数组名[  行数  ][  列数   ] = {{  数据1,数据2},{数据3,数据4}  };//更直观,提高代码可读性

数据类型  数组名[  行数  ][  列数   ] = {数据1,数据2,数据3,数据4};

数据类型  数组名[     ][  列数   ] = {数据1,数据2,数据3,数据4};

5.3.2二维数组的数组名

  • 可以查看占用内存空间大小

  • 可以查看二维数组的首地址

5.3.3 二维数据应用案例

统计考试成绩的总和:

#include<iostream>

using namespace std;

#include<string>

int main()

{    //创建二维数组

       int scores[3][3] = {

               {100,100,100},

               {90,50,100},

               {60,70,80}

       };

       //统计每个人的总和分数

       string names[3] = {"张三","李四","王五"};

       for (int i = 0; i < 3; i++)

       {

               int sum = 0;

               for (int j = 0; j < 3; j++)

               {

                      sum += scores[i][j];

               }

               cout << names[i]<<"的考试总分为   "<<sum<< endl;

       }

       system("pause");

       return 0;

}

六、函数

6.1 概述

6.2 函数的定义

语法:

返回值类型  函数名  (参数列表)

{

        函数体语句;

        return表达式;

}

6.3 函数的调用

语法:函数名(参数)

6.4值传递

  • 所谓值传递,就是函数调用时实参将数值传入给形参

  • 值传递时,如果形参发生变化,并不会影响实参。

值传递案例:

#include<iostream>

using namespace std;

#include<string>

  //值传递:定义函数,实现两个数字进行交换函数

       //如果函数不需要返回值。,声明的时候可以写void

       void swap(int num1, int num2)

       {

               int temp = 0;

               temp = num1;

               num1 = num2;

               num2 = temp;

               cout << "交换后:  " << endl;

               cout << "num1 = :  " << num1 <<endl;

               cout << "num2 = :  " << num2 << endl;

       }

int main( )

{

               int a = 5;

               int b = 6;

               swap(a,b);

               system("pause");

               return 0;

}

6.5 函数的常见样式:

无参无返、有参无返、无参有返、有参有返

6.6 函数的声明

  • 函数的声明可以有多次,但是函数的定义只能有一次

6.7 函数的分文件编写(看视频55进行熟悉~)

步骤:

  1. 创建后缀名为.h的头文件

  2. 创建后缀名为.cpp的源文件

  3. 在头文件中写函数的声明

  4. 在源文件中写函数的定义


七、指针

7.1指针的基本概念

作用:可以通过指针间接访问内存

  • 内存编号是从0开始记录的,一般用16进制数字表示

  • 可以利用指针变量保存地址

指针就是一个地址:

int a = 10,这个10占用的地址是0x0000,而指针P就是一个地址,这里存0x0000代表上边的10

怎么通过指针0x0000去拿到数据10,这是我们需要解决的

7.2指针变量的定义和使用

语法:    数据类型     *   变量名;

//定义变量

int a =10;

//定义指针

int *p;

//让指针记录变量a的地址

p = &a;

//或者int *p = &a;

//使用指针

//可以通过解引用的方式来找到指针指向的内存

//指针前加*代表解引用,找到指针指向的内存中的数据

*p = 1000

//那么a则被改为1000,*P也为1000

7.3 指针所占的内存空间

提问:指针也是种数据类型,那么这种数据类型占用多少内存空间呢??

32位【Debug x86】操作系统4字节,64位【Debug x64】操作系统8字节。不管是什么数据类型

7.4 空指针和野指针

空指针:指针变量指向内存中编号为0的空间

用途:初始化指针变量

注意:空指针指向的内存是不可以访问的,讲就是不能*p

//空指针

//空指针用于给指针变量进行初始化

int *p = NULL;

//空指针是不可以进行访问的

//0~255之间的内存编号是系统占用的,u因此不可以访问

野指针:指针变量指向非法的内存空间

int *p = (int*)0x0000;

7.5 const修饰指针

const修饰指针有三种情况

  1. const修饰指针 -- 常量指针

  2. const修饰常量 --指针常量

  3. const既修饰指针,又修饰常量

int a = 10;

int b = 10;

int *p = &a;

情况一:

const int *p = &a;//常量指针

//常量指针的特点:指针的指向可以修改,但是指针指向的值不可以修改。

*p = 20;//错误,指针指向的值不可以修改

p = &b;//正确,指针指向可以修改。

情况二:

int *const p = &a;//指针常量

//指针常量的特点:指针指向不可以修改,指针指向的值可以改

情况三:

const int* const p = &a;//指针的指向和指向的值都不可以改

7.6 指针和数组

作用:利用指针访问数组中的元素。

int arr[10] = { 1,2,3,4,5,6,7,8,9,10 };

cout<<"利用指针遍历数组  "<<endl;

int *p2 = arr;

for(int i=0;i<10;i++)

{

    cout<<*p2<<endl;

    p2++;

}

7.7 指针和函数

作用:利用指针作函数参数,可以修改实参的值

#include<iostream>

using namespace std;

#include<string>

  

       //如果函数不需要返回值。,声明的时候可以写void

       void swap1(int num1, int num2)//值传递:定义函数,实现两个数字进行交换函数

       {

               int temp = 0;

               temp = num1;

               num1 = num2;

               num2 = temp;

               cout << "交换后:  " << endl;

               cout << "num1 = :  " << num1 <<endl;

               cout << "num2 = :  " << num2 << endl;

       }

       void swap2(int *p1, int *p2)//地址传递,可以修改实参的值

       {

               int temp = *p1;

               *p1 = *p2;

               *p2 = temp;

       }

int main( )

{

               int a = 5;

               int b = 6;

               swap1(a,b);

               swap2(&a, &b);

               cout << "a= " << a << endl;

               cout << "b= " << b << endl;

               system("pause");

               return 0;

}

 7.8 指针、数组、函数

案例描述:封装一个函数,利用冒泡排序,实现对整型数组的升序排序

#include<iostream>

using namespace std;

#include<string>

void maopao(int len, int *arr)

{

       for (int i = 0; i < len - 1; i++)

       {

               for (int j = 0; j < len - i - 1; j++)

               {

                      if (arr[j] > arr[j + 1])

                      {

                              int temp = arr[j];

                              arr[j] = arr[j + 1];

                              arr[j + 1] = temp;

                      }

               }

       }

       return;

}

void printarray(int *arr, int len)

{

       for (int i = 0; i < len; i++)

       {

               cout << arr[i] << endl;

       }

}

int main( )

{

       int arr[10] = {4,3,6,9,1,2,10,8,7,5};

       int len = sizeof(arr)/sizeof(arr[0]);

       maopao(len,arr);

       printarray(arr,len);

       system("pause");

       return 0;

}

八、结构体

8.1 结构体的基本概念

结构体属于用户自定义的数据类型,允许用户存储不同的数据类型

8.2 结构体定义和使用

定义的语法:struct 结构体名 { 结构体成员列表 };

使用的语法通过结构体创建变量的方式有三种:

struct 结构体名 变量名;

struct 结构提名 变量名 = { 成员1值,成员2值,... };

定义结构体时顺便创建变量。
#include<iostream>

using namespace std;

#include<string>

//结构体定义,这时的struct不可以省略

struct student

{

       string name;

       int age;

       int score;

}s3;

int main( )

{

       //2.1 struct student s1,创建结构体变量时,关键字struct可以省略

       struct student s1;

       s1.name = "张三";

       s1.age = 18;//结构体变量利用操作符“.”访问成员。

       s1.score = 100;

       cout << "姓名:" << s1.name  << "    年龄:" << s1.age << "   分数:" << s1.score  << endl;

       //2.2struct student s2 = { ... };

       struct student s2 = {"李四",19,80};

       cout << "姓名:" << s2.name << "    年龄:" << s2.age << "   分数:" << s2.score  << endl;

       //2.3在定义结构体时顺便创建结构体变量,比如上边创建时最后的s3是后加的,s1和s2是自己用的时候自己定义的

       s3.name = "王五";

       s3.age = 20;

       s3.score = 120;

       cout << "姓名:" << s3.name << "    年龄:" << s3.age << "   分数:" << s3.score  << endl;

       system("pause");

       return 0;

}

8.3 结构体数组

作用:将自定义的结构体放入到数组中方便维护

语法:

struct 结构体名   数组名[元素个数]  =  {   { }, { },... {  }   };
#include<iostream>

using namespace std;

#include<string>

//结构体定义,这时的struct不可以省略

struct student

{

       string name;

       int age;

       int score;

};

int main( )

{

       //2.创建结构体数组

       struct student stuArray[8] =

       {

               {"张三",18,100},

               {"李四",19,80},

               {"王五",20,120}

       };

       //3.给结构体数组中元素赋值

       stuArray[2].name = "赵六";

       stuArray[2].age = 80;

       stuArray[2].score = 60;

       //遍历结构体数组

       for (int i = 0; i < 3; i++)

       {

               cout  << "姓名:" << stuArray[i].name <<

                      "    年龄:" << stuArray[i].age <<

                      "   分数:" << stuArray[i].score << endl;

       }

       

       system("pause");

       return 0;

}

  8.4 结构体指针

作用:通过指针访问结构体中的成员

利用操作符 -> 可以通过结构体指针访问结构体属性

#include<iostream>

using namespace std;

#include<string>

//结构体定义,这时的struct不可以省略

struct student

{

       string name;

       int age;

       int score;

};

int main( )

{

       //1.创建结构体变量

       struct student s = {"张三",18,100};

       //2.通过指针指向结构体变量

       struct student *p = &s;

       //3.通过指针访问结构体变量中的数据

        

       cout << "姓名:" << p->name <<

       "    年龄:" << p->age <<

       "   分数:" << p->score<< endl;

       

       

       system("pause");

       return 0;

}

       

//指针与结构体

#include<iostream>

using namespace std;

#include<string>

//结构体定义,这时的struct不可以省略

struct student

{

       string name;

       int age;

       int score;

};

void printinfo(struct student *p)

{

       cout << "姓名:" << p->name <<

               "    年龄:" << p->age <<

               "   分数:" << p->score << endl;

};

int main()

{

       //1.创建结构体变量

       struct student s = { "张三",18,100 };

       //2.通过指针指向结构体变量

       //struct student *p = &s;

       //3.通过指针访问结构体变量中的数据

       printinfo(&s);

       system("pause");

       return 0;

}

8.5 结构体嵌套结构体

作用:结构体中的成员可以是另一个结构体

例如:每个老师辅导一个学员,一个老师的结构体中,记录一个学生的结构体

#include<iostream>

using namespace std;

#include<string>

//定义学生结构体

struct student

{

       string name;

       int age;

       int score;

};

//定义老师结构体

struct teacher

{

       int id;

       string name;

       int age;

       struct student stu;

};

int main( )

{

       //1.创建结构体变量

       struct teacher t;

       t.id = 10000;

       t.name = "老王老师";

       t.age = 50;

       t.stu.name = "小王同学";

       t.stu.age = 18;

       t.stu.score = 100;

       //2.通过指针访问结构体变量中的数据

        

       cout << "老师姓名:" << t.name <<

       "    老师年龄:" << t.age <<

       "   学生姓名:" << t.stu.name <<

       "   学生年龄:" << t.stu.score << endl;

       

       

       system("pause");

       return 0;

}

  8.6 结构体做函数参数

作用:将结构体作为参数向函数中传递

传递方式两种:值传递、地址传递

#include<iostream>

using namespace std;

#include<string>

//定义学生结构体

struct student

{

       string name;

       int age;

       int score;

};

void printstudent(struct student s)//值传递

{

       cout << "姓名:" << s.name << "    年龄:" << s.age << "   学生年龄:" << s.score  << endl;

};

void printstudent2(struct student *p)//地址传递

{

       cout << "姓名:" << p->name << "    年龄:" << p->age << "   学生年龄:" <<  p->score << endl;

}

int main( )

{

       //1.创建结构体变量

       struct student s;

       s.name = "张三";

       s.age = 18;

       s.score = 100;

       printstudent(s);

       printstudent2(&s);

       system("pause");

       return 0;

}

  8.7 结构体中const使用场景

作用:用const来防止误操作

#include<iostream>

using namespace std;

#include<string>

//定义学生结构体

struct student

{

       string name;

       int age;

       int score;

};


void printstudent2(struct const student *p)//地址传递,节省地址,加了const防止误修改

{

       cout << "姓名:" << p->name << "    年龄:" << p->age << "   学生年龄:" <<  p->score << endl;

}

int main( )

{

       //1.创建结构体变量

       struct student s;

       s.name = "张三";

       s.age = 18;

       s.score = 100;

       printstudent2(&s);

       system("pause");

       return 0;

}

8.8 结构体案例一

效果:

//方法一:用数组形式传入及打印数据

#include<iostream>

#include<string>

#include<ctime>

using namespace std;

//定义学生结构体

struct student

{

       string sname;

       int score;

};

//定义老师结构体

struct teacher

{

       string tname;

       struct student sarray[5];

};

void fuzhi(struct teacher tarray[],int len)

{

       string seedname = "ABCDE";

       for (int i = 0; i < len; i++)

       {

               tarray[i].tname = "老师_";

               tarray[i].tname += seedname[i];

               for (int j = 0; j < 5; j++)

               {

                      tarray[i].sarray[j].sname = "学生_";

                      tarray[i].sarray[j].sname += seedname[j];

                      int random = rand() % 61 + 40;

                      tarray[i].sarray[j].score = random;

               }

       }

};

void printinfo(struct teacher tarray[], int len)

{

       for (int i = 0; i < len; i++)

       {

               cout << "老师姓名:" << tarray[i].tname << endl;

               for (int j = 0; j < 5; j++)

               {

                      cout << "\t学生姓名:" << tarray[i].sarray[j].sname << "    学生成绩:" << tarray[i].sarray[j].score << endl;

               };

       };

};

int main( )

{

       //添加随机数种子

       srand((unsigned int)time(NULL));

       //定义老师数组

       struct teacher tarray[3];

       //给老师和学生赋值

       int len = sizeof(tarray) / sizeof(tarray[0]);

       fuzhi(tarray,len);

       //打印数据

       printinfo(tarray, len);

       system("pause");

       return 0;

}

//方法二:用指针地址传入以及打印数据

#include<iostream>

#include<string>

#include<ctime>

using namespace std;

//定义学生结构体

struct student

{

       string sname;

       int score;

};

//定义老师结构体

struct teacher

{

       string tname;

       struct student sarray[5];

};

void fuzhi(struct teacher *p,int len)

{

       string seedname = "ABCDE";

       for (int i = 0; i < len; i++)

       {

               p->tname = "老师_";

               p->tname += seedname[i];

               

               for (int j = 0; j < 5; j++)

               {

                      

                      p->sarray[j].sname = "学生_";

                      p->sarray[j].sname += seedname[j];

                      int random = rand() % 61 + 40;

                      p->sarray[j].score = random;

               }

               p++;

       }

};

void printinfo(struct teacher *p, int len)

{

       for (int i = 0; i < len; i++)

       {

               cout << "老师姓名:" << p->tname << endl;

               

               for (int j = 0; j < 5; j++)

               {

                      cout << "\t学生姓名:" << p->sarray[j].sname << "    学生成绩:" <<  p->sarray[j].score << endl;

               };

               p++;

       };

};

int main( )

{

       //添加随机数种子

       srand((unsigned int)time(NULL));

       //定义老师数组

       struct teacher tarray[3];

       //int tarray[3];

       //给老师和学生赋值

       int len = sizeof(tarray) / sizeof(tarray[0]);

       fuzhi(tarray,len);

       //打印数据

       printinfo(tarray, len);

       system("pause");

       return 0;

}

8.9 结构体案例二

007b7549d4cb42a2b7d9d5dca8aa4e37.png

#include<iostream>

#include<string>

#include<ctime>

using namespace std;

//定义学生结构体

struct hero

{

       string sname;

       int age;

       string gender;

};

void fuzhi(struct hero harray[], int len)

{

       harray[0].sname = "刘备";

       harray[1].sname = "关羽";

       harray[2].sname = "张飞";

       harray[3].sname = "赵云";

       harray[4].sname = "貂蝉";

       harray[0].age = 23;

       harray[1].age = 22;

       harray[2].age = 20;

       harray[3].age = 21;

       harray[4].age = 19;

       harray[0].gender = "男";

       harray[1].gender = "男";

       harray[2].gender = "男";

       harray[3].gender = "男";

       harray[4].gender = "女";

};

void paixu(struct hero harray[], int len)

{

       for (int i = 0; i < len - 1; i++)

       {

               for (int j = 0; j < len - i - 1; j++)

               {

                      if (harray[j].age > harray[j + 1].age)

                      {

                              struct hero temp = harray[j];

                              harray[j] = harray[j + 1];

                              harray[j + 1] = temp;

                      };

               };

       };

};

void printinfo(struct hero harray[], int len)

{

       for (int i = 0; i< len; i++)

       {

               cout << "英雄的姓名为:" << harray[i].sname << "英雄的年龄为:" <<  harray[i].age << "英雄的性别为:" << harray[i].gender << endl;

       };

};

int main()

{

       

       //定义老师数组

       struct hero harray[5];

       //给老师和学生赋值

       int len = sizeof(harray) / sizeof(harray[0]);

       fuzhi(harray, len);

       paixu(harray, len);

       //打印数据

       printinfo(harray, len);

       system("pause");

       return 0;

}

九、#####通讯录管理系统

大纲

1、系统需求

2、创建项目

3、菜单功能

4、退出功能

5、添加联系人

6、显示联系人

7、删除联系人

8、查找联系人

9、修改联系人

10、清空联系人

5、添加联系人

实现步骤:

  • 涉及联系人结构体

  • 涉及通讯录结构体

  • main函数中创建通讯录

  • 封装添加联系人函数

  • 测试添加联系人功能



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值