📄 main.c
字号:
#include <stdio.h>#include "declare.h"int SetData(){ //获取数据源函数 int slt; int count_length; char buf[12]; while (1)//当输入的字符不是"0.1.2"时就继续输入 { GetDataFace();//调用第二函数界面 scanf("%s",buf);//选择功能 slt = atoi(buf); //把字符串转化为整形数 switch(slt) { case 0://返回 return 0; case 1://文件读入 system("clear"); //清屏 count_length=ReadFromFile();//调用 printf("OK!The data already set,press ENTER key to continue:"); getchar(); getchar(); return count_length; case 2://直接输入 system("clear");//清屏 count_length=InputData(); //调用 printf("OK!The data already set,press ENTER key to continue:"); getchar(); getchar(); return count_length; } }}int main(){ int slt; int n,sum,count_length=0; char buf[12]; while (1)//当输入的字符不是"0.1.2.3"时就继续输入 { MainFace();//调用界面函数 scanf("%s",buf);//选择功能 slt = atoi(buf);//把字符串转化为整形数 switch(slt) { case 0: //退出 return 0; case 1: //获取数据源 count_length=SetData(); break; case 2: //二线程求和 system("clear");//清屏 printf("The summation of array is: %d\n",arr2sum(count_length)); //调用求和并输出结果 printf("Press ENTER key to continue:"); getchar();getchar(); break; case 3: //多线程求和 system("clear");//清屏 printf("Input the number of thread:"); scanf("%s",buf); n=atoi(buf);//输入的线程数 printf("The summation of array is: %d\n",arrnsum(count_length,n)); //调用求和并输出结果 printf("Press ENTER key to continue:"); getchar();getchar(); break; } } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -