C++實現(xiàn)車票管理系統(tǒng)
本文實例為大家分享了C++實現(xiàn)車票管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
一車站每天有n個發(fā)車班次,每個班次都有一班次號(1、2、3…n),固定的發(fā)車時間,
固定的路線(起始站、終點(diǎn)站),大致的行車時間,固定的額定載客量。如
班次 發(fā)車時間 起點(diǎn)站 終點(diǎn)站 行車時間 額定載量 已定票人數(shù)
1 8:00 郫縣 廣漢 2 45 30
2 6:30 郫縣 成都 0.5 40 40
3 7:00 郫縣 成都 0.5 40 20
4 10:00 郫縣 成都 0.5 40 2
…
功能要求:
(1)錄入班次信息(信息用文件保存),可不定時地增加班次數(shù)據(jù)
(2)瀏覽班次信息,可顯示出所有班次當(dāng)前狀總(如果當(dāng)前系統(tǒng)時間超過了某班次的發(fā)車時間,則顯示“此班已發(fā)出”的提示信息)。
(3)查詢路線:可按班次號查詢 ,可按終點(diǎn)站查詢
(4)售票和退票功能
A:當(dāng)查詢出已定票人數(shù)小于額定載量且當(dāng)前系統(tǒng)時間小于發(fā)車時間時才能售票,自動更新已售票人數(shù)
B:退票時,輸入退票的班次,當(dāng)本班車未發(fā)出時才能退票,自動更新已售票人數(shù)
下面是 代碼。
工具是VS2019、MySQL8.0
注意:請?zhí)崆霸O(shè)置好VS 的環(huán)境,否則運(yùn)行不出來。本人是個菜鳥,代碼可能比較復(fù)雜比較low,輕噴。
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <WinSock2.h>
#include <mysql.h>
#include <Windows.h>
#include <time.h>
#include <iostream>
using namespace std;
//包含附加依賴項,也可以在工程--屬性里面設(shè)置
//#pragma comment(lib,"wsock32.lib")
//#pragma comment(lib,"libmysql.lib")
MYSQL mysql; //mysql連接
MYSQL_FIELD* fd; ?//字段列數(shù)組
char field[32][32]; ?//存字段名二維數(shù)組
MYSQL_RES* res; //這個結(jié)構(gòu)代表返回行的一個查詢結(jié)果集
MYSQL_ROW column,row; //一個行數(shù)據(jù)的類型安全(type-safe)的表示,表示數(shù)據(jù)行的列
char query[150]; //查詢語句
bool ConnectDatabase(); ? ? //函數(shù)聲明
void FreeConnect();
bool read(); ?//查詢1
bool search(); ?//查詢2
bool input();
bool piao();
void mainmenu();
bool readtest();
int main(int argc, char** argv)
{
? ? int m;
? ? int k = 1;
? ? ConnectDatabase();
? ? mainmenu();
? ? while(k==1)
? ? {
? ? ? ? printf("\n");
? ? ? ? printf(" 請選擇功能:");
? ? ? ? cin >> m;
? ? ? ? switch (m)
? ? ? ? {
? ? ? ? case ?1 :input(); break;//錄入車票信息
? ? ? ? case ?2 :read(); break;//瀏覽車票信息
? ? ? ? case ?3 :search(); break;// 查詢車票信息
? ? ? ? case ?4 :piao(); break;//售票和退票
? ? ? ? case ?5 : k = 0; break;//退出系統(tǒng)
? ? ? ? }
? ? }
? ? FreeConnect();
? ? system("pause");
? ? return 0;
}
//連接數(shù)據(jù)庫
bool ConnectDatabase()
{
? ? //初始化mysql
? ? mysql_init(&mysql); ?//連接mysql,數(shù)據(jù)庫
? ? //返回false則連接失敗,返回true則連接成功
? ? if (!(mysql_real_connect(&mysql, "localhost", "root", "123456", "chepiao", 3306, NULL, 0))) //中間分別是主機(jī),用戶名,密碼,數(shù)據(jù)庫名,端口號,可以先寫成參數(shù)再傳進(jìn)去
? ? {
? ? ? ? printf("Error connecting to database:%s\n", mysql_error(&mysql));
? ? ? ? return false;
? ? }
? ? else
? ? {
? ? ? ? printf("Connected ?success\n");
? ? ? ? return true;
? ? }
}
void mainmenu()
{
? ? cout << "\n\n--------歡迎使用車票管理系統(tǒng)----------" << endl << endl;
? ? cout << "===========================================" << endl;
? ? cout << "||========================================||" << endl;
? ? cout << "|| ? ? ? ? ? ?1.錄入車票信息 ? ? ? ? ? ? ?||" << endl;
? ? cout << "|| ? ? ? ? ? ?2.瀏覽車票信息 ? ? ? ? ? ? ?||" << endl;
? ? cout << "|| ? ? ? ? ? ?3.查詢車票信息 ? ? ? ? ? ? ?||" << endl;
? ? cout << "|| ? ? ? ? ? ?4.售票和退票 ? ? ? ? ? ? ? ?||" << endl;
? ? cout << "|| ? ? ? ? ? ?5.退出系統(tǒng) ? ? ? ? ? ? ? ? ?||" << endl;
? ? cout << "||========================================||" << endl;
? ? cout << "============================================" << endl;
}
//釋放資源
void FreeConnect()
{
? ? //釋放資源
? ? mysql_free_result(res);
? ? mysql_close(&mysql);
}
//數(shù)據(jù)庫操作
//其實所有的數(shù)據(jù)庫操作都是先寫個sql語句,然后用mysql_query(&mysql,query)來完成,包括創(chuàng)建數(shù)據(jù)庫或表,增刪改查
bool readtest()
{
? ? struct tm* local;
? ? time_t t;
? ? t = time(NULL);
? ? sprintf(query, "select * from testTable"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //返回0 查詢成功,返回1查詢失敗
? ? mysql_query(&mysql, query); ? ? //執(zhí)行SQL語句
? ? //獲取結(jié)果集
? ? if (!(res = mysql_store_result(&mysql))) ? ?//獲得sql語句結(jié)束后返回的結(jié)果集
? ? {
? ? ? ? printf("Couldn't get result from %s\n", mysql_error(&mysql));
? ? ? ? return false;
? ? }
? ? local = localtime(&t);//獲取當(dāng)前系統(tǒng)時間
? ? int num = local->tm_hour;
? ? int num1 = local->tm_min;
? ? char str1[25], str2[25];
? ? sprintf(str1, "%d", num);
? ? sprintf(str2, "%d", num1);
? ? char a[5] = ":";
? ? char s[1000];
? ? int n;
? ? strcpy(s, str1);
? ? strcat(s, a);
? ? strcat(s, str2);
? ? cout << endl;
? ? //printf(" 當(dāng)前系統(tǒng)時間為:%10s\t\n", s);
? ? //cout << endl;
? ? char* str_field[32]; ?//定義一個字符串?dāng)?shù)組存儲字段信息
? ? for (int i = 0; i < 8; i++) ? //在已知字段數(shù)量的情況下獲取字段名
? ? {
? ? ? ? str_field[i] = mysql_fetch_field(res)->name;
? ? }
? ? /*for (int i = 0; i < 8; i++) ? //打印字段
? ? ? ? printf("%10s\t", str_field[i]);
? ? printf("\n");*/
? ? while (column = mysql_fetch_row(res)) ? //在已知字段數(shù)量情況下,獲取并打印下一行
? ? {
? ? ? ? char test[1000];
? ? ? ? char co[1000];
? ? ? ? char abc[5] = "'";
? ? ? ? int j = 0;
? ? ? ? strcpy(co, column[1]);
? ? ? ? while (co[j] != ':')
? ? ? ? {
? ? ? ? ? ? if ((co[j] > 47) && (co[j] < 58))
? ? ? ? ? ? {
? ? ? ? ? ? ? ? test[j] = co[j];
? ? ? ? ? ? ? ? j++;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? if (j == 2)
? ? ? ? ? ? n = (test[0] - '0') * 10 + (test[1] - '0');
? ? ? ? else if (j == 1)
? ? ? ? ? ? n = (test[0] - '0');
? ? ? ? if ((local->tm_hour) < n)
? ? ? ? {
? ? ? ? ? ? sprintf(query, "update testtable set 當(dāng)前狀況='此車未發(fā)出' where 發(fā)車時間='");
? ? ? ? ? ? strcat(query, column[1]);
? ? ? ? ? ? strcat(query, abc);
? ? ? ? ? ? mysql_query(&mysql, query);
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? sprintf(query, "update testtable set 當(dāng)前狀況='此車已發(fā)出'where 發(fā)車時間='");
? ? ? ? ? ? strcat(query, column[1]);
? ? ? ? ? ? strcat(query, abc);
? ? ? ? ? ? mysql_query(&mysql, query);
? ? ? ? }
? ? ? ? //打印獲取的數(shù)據(jù)
? ? ? ? printf("%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\n", column[0], column[1], column[2], column[3], column[4], column[5], column[6], column[7]); ?//column是列數(shù)組
? ? }
? ? return true;
}
//瀏覽數(shù)據(jù)
bool read()
{
? ? struct tm* local;
? ? time_t t;
? ? t = time(NULL);
? ? sprintf(query, "select * from testTable"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //返回0 查詢成功,返回1查詢失敗
? ? mysql_query(&mysql, query); ? ? //執(zhí)行SQL語句
? ? ?
? ? //獲取結(jié)果集
? ? if (!(res = mysql_store_result(&mysql))) ? ?//獲得sql語句結(jié)束后返回的結(jié)果集
? ? {
? ? ? ? printf("Couldn't get result from %s\n", mysql_error(&mysql));
? ? ? ? return false;
? ? }
? ? local = localtime(&t);//獲取當(dāng)前系統(tǒng)時間
? ? int num = local->tm_hour;
? ? int num1 = local->tm_min;
? ? char str1[25], str2[25];
? ? sprintf(str1, "%d", num);
? ? sprintf(str2, "%d", num1);
? ? char a[5] = ":";
? ? char s[1000];
? ? int n;
? ??
? ? strcpy(s, str1);
? ? strcat(s, a);
? ? strcat(s, str2);
? ? cout << endl;
? ? printf(" 當(dāng)前系統(tǒng)時間為:%10s\t\n", s);
? ? cout << endl;
? ? char* str_field[32]; ?//定義一個字符串?dāng)?shù)組存儲字段信息
? ? for (int i = 0; i < 8; i++) ? //在已知字段數(shù)量的情況下獲取字段名
? ? {
? ? ? ? str_field[i] = mysql_fetch_field(res)->name;
? ? }
? ? for (int i = 0; i < 8; i++) ? //打印字段
? ? ? ? printf("%10s\t", str_field[i]);
? ? printf("\n");
? ?
? ? while (column = mysql_fetch_row(res)) ? //在已知字段數(shù)量情況下,獲取并打印下一行
? ? { ? char test[1000];
? ? ? ? char co[1000];
? ? ? ? char abc[5]="'";
? ? ? ? int j = 0;
? ? ? ? strcpy(co, column[1]);
? ? ? ? while (co[j] != ':')
? ? ? ? {
? ? ? ? ? ? if ((co[j] > 47) && (co[j] < 58))
? ? ? ? ? ? {
? ? ? ? ? ? ? ? test[j] = co[j];
? ? ? ? ? ? ? ? j++;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? if (j == 2)
? ? ? ? ? ? n = (test[0] - '0') * 10 + (test[1] - '0');
? ? ? ? else if (j == 1)
? ? ? ? ? ? n = (test[0] - '0');
? ? ? ? if ((local->tm_hour )<n)
? ? ? ? {
? ? ? ? ? ?
? ? ? ? ? ? sprintf(query, "update testtable set 當(dāng)前狀況='此車未發(fā)出' where 發(fā)車時間='");
? ? ? ? ? ? strcat(query,column[1]);
? ? ? ? ? ? strcat(query,abc);
? ? ? ? ? ? mysql_query(&mysql, query);
? ? ? ? }
? ? ? ? else?
? ? ? ? {
? ? ? ? ? ? sprintf(query, "update testtable set 當(dāng)前狀況='此車已發(fā)出'where 發(fā)車時間='");
? ? ? ? ? ? strcat(query, column[1]);
? ? ? ? ? ? strcat(query, abc);
? ? ? ? ? ? mysql_query(&mysql, query);
? ? ? ? }
? ? ? ? ?
? ? ? ??
? ? }
? ? readtest();
? ? return true;
}
//查詢數(shù)據(jù)
bool search()
{
? ? int y;
? ? int m;
? ? char n[5];
? ? char s[100];
? ? char abc[5] = "'";
? ? printf(" 請輸入查詢方式:1 按班次號查詢 ;2 按終點(diǎn)站查詢\n");
? ? printf(" 請輸入您的操作: ");
? ? cin >> m;
? ? if (m == 1)
? ? {
? ? ? ? printf(" 請輸入您要查詢的班次號: ?");
? ? ? ? cin >> n;
? ? ? ? sprintf(query, "select * from testtable where 班次='"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? ? ? strcat(query, n);
? ? ? ? strcat(query, abc);
? ? ? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? mysql_query(&mysql, query); ? ?//執(zhí)行SQL語句
? ? ? ? //獲取結(jié)果集
? ? ? ? if (!(res = mysql_store_result(&mysql))) ? ?//獲得sql語句結(jié)束后返回的結(jié)果集
? ? ? ? {
? ? ? ? ? ? printf("Couldn't get result from %s\n", mysql_error(&mysql));
? ? ? ? ? ? return false;
? ? ? ? }
? ? ? ? for (int i = 0; fd = mysql_fetch_field(res); i++) ?//獲取字段名
? ? ? ? ? ? strcpy(field[i], fd->name);
? ? ? ? int j = mysql_num_fields(res); ?// 獲取列數(shù)
? ? ? ? printf("\n");
? ? ? ? for (int i = 0; i < j; i++) ?//打印字段
? ? ? ? ? ? printf("%10s\t", field[i]);
? ? ? ? printf("\n");
? ? ? ? while (column = mysql_fetch_row(res))
? ? ? ? {
? ? ? ? ? ? printf("%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\n", column[0], column[1], column[2], column[3], column[4], column[5], column[6], column[7]); ?//column是列數(shù)組
? ? ? ? }
? ? }
? ? else if (m == 2)
? ? {
? ? ? ? printf(" 請輸入您要查詢的終點(diǎn)站: ?");
? ? ? ? cin >> s;
? ? ? ? sprintf(query, "select * from testTable where 終點(diǎn)站='"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? ? ? strcat(query, s);
? ? ? ? strcat(query, abc);
? ? ? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? mysql_query(&mysql, query); ? ?//執(zhí)行SQL語句
? ? ? ? //獲取結(jié)果集
? ? ? ? if (!(res = mysql_store_result(&mysql))) ? ?//獲得sql語句結(jié)束后返回的結(jié)果集
? ? ? ? {
? ? ? ? ? ? printf("Couldn't get result from %s\n", mysql_error(&mysql));
? ? ? ? ? ? return false;
? ? ? ? }
? ? ? ? for (int i = 0; fd = mysql_fetch_field(res); i++) ?//獲取字段名
? ? ? ? ? ? strcpy(field[i], fd->name);
? ? ? ? int j = mysql_num_fields(res); ?// 獲取列數(shù)
? ? ? ? printf("\n");
? ? ? ? for (int i = 0; i < j; i++) ?//打印字段
? ? ? ? ? ? printf("%10s\t", field[i]);
? ? ? ? printf("\n");
? ? ? ? while (column = mysql_fetch_row(res))
? ? ? ? {
? ? ? ? ? ? printf("%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\n", column[0], column[1], column[2], column[3], column[4], column[5], column[6], column[7]); ?//column是列數(shù)組
? ? ? ? }
? ? }
? ? printf("\n");
? ? printf(" ?1 繼續(xù)查詢;2 返回主界面\n");
? ? printf(" 請輸入您的操作: ");
? ? cin >> y;
? ? if (y == 1)
? ? {
? ? ? ? search();
? ? }
? ? else if (y == 2)
? ? {
? ? ? ? mainmenu();
? ? }
? ? return true;
}
//錄入數(shù)據(jù)
bool input()
{
? ? sprintf(query, "insert into testtable values (6, '18:00', '青島','濟(jì)南',3,20,10,'NULL')"); ?//可以想辦法實現(xiàn)手動在控制臺手動輸入指令
? ? mysql_query(&mysql, query); ? ? ?//執(zhí)行SQL語句
? ? ? ? printf(" Insert success\n");
? ? ? ? read();
? ? ? ? return true;
? ??
}
//售票和退票
bool piao()
{ ? int y;
? ? int m,a,b;
? ? char n[5];
? ? char k[5];
? ? char abc[5] = "'";
? ? char cc[100] = " where 班次='";
? ? printf(" 請選擇操作:1 售票;2 退票");
? ? cout << endl;
? ? printf(" 請輸入: ");
? ? cin >> m;
? ? if (m == 1)//售票
? ? {
? ? ? ? printf(" 請輸入您要購買的車票班次: ?");
? ? ? ? cin >> k;
? ? ? ? sprintf(query, "select * from testtable where 班次='"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? ? ? strcat(query, k);
? ? ? ? strcat(query, abc);
? ? ? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? mysql_query(&mysql, query); ? ?//執(zhí)行SQL語句
? ? ? ? //獲取結(jié)果集
? ? ? ? if (!(res = mysql_store_result(&mysql))) ? ?//獲得sql語句結(jié)束后返回的結(jié)果集
? ? ? ? {
? ? ? ? ? ? printf("Couldn't get result from %s\n", mysql_error(&mysql));
? ? ? ? ? ? return false;
? ? ? ? }
? ? ? ? for (int i = 0; fd = mysql_fetch_field(res); i++) ?//獲取字段名
? ? ? ? ? ? strcpy(field[i], fd->name);
? ? ? ? int j = mysql_num_fields(res); ?// 獲取列數(shù)
? ? ? ??
? ? ? ? column = mysql_fetch_row(res);
? ? ? ? a = atoi(column[6]);
? ? ? ? b = atoi(column[5]);
? ? ? ? if ((a < b) && (!strcmp(column[7],"此車未發(fā)出")))
? ? ? ? {
? ? ? ? ? ? printf("\n");
? ? ? ? ? ? printf("售票成功\n");
? ? ? ? ? ? printf("\n");
? ? ? ? for (int i = 0; i < j; i++) ?//打印字段
? ? ? ? ? ? printf("%10s\t", field[i]);
? ? ? ? printf("\n");
? ? ? ? ? ? a = a + 1;
? ? ? ? ? ? itoa(a,column[6],10);
? ? ? ? ? ? sprintf(query, "update testtable set 已訂票人數(shù)='"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? ? ? ? ? strcat(query, column[6]);
? ? ? ? ? ?strcat(query, abc);
? ? ? ? ? ?strcat(query, cc);
? ? ? ? ? ? ?strcat(query, k);
? ? ? ? ? ? ?strcat(query, abc);
? ? ? ? ? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? ? ? mysql_query(&mysql, query); ? ?//執(zhí)行SQL語句
? ? ??
? ? ? ? ? ? ? ? printf("%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\n", column[0], column[1], column[2], column[3], column[4], column[5], column[6], column[7]); ?//column是列數(shù)組
? ? ? ? }
? ? }
? ? else if (m == 2)//退票
? ? {
? ? ? ??
? ? ? ? printf(" 請輸入您要退訂的車票班次: ?");
? ? ? ? cin >> n;
? ? ? ? sprintf(query, "select * from testtable where 班次='"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? ? ? strcat(query, n);
? ? ? ? strcat(query, abc);
? ? ? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? mysql_query(&mysql, query); ? ?//執(zhí)行SQL語句
? ? ? ? //獲取結(jié)果集
? ? ? ? if (!(res = mysql_store_result(&mysql))) ? ?//獲得sql語句結(jié)束后返回的結(jié)果集
? ? ? ? {
? ? ? ? ? ? printf("Couldn't get result from %s\n", mysql_error(&mysql));
? ? ? ? ? ? return false;
? ? ? ? }
? ? ? ?
? ? ? ? for (int i = 0; fd = mysql_fetch_field(res); i++) ?//獲取字段名
? ? ? ? ? ? strcpy(field[i], fd->name);
? ? ? ? int j = mysql_num_fields(res); ?// 獲取列數(shù)
? ? ? ??
? ? ? ? column = mysql_fetch_row(res);
? ? ? ? a = atoi(column[6]);
? ? ? ? if (!strcmp(column[7], "此車未發(fā)出"))
? ? ? ? {
? ? ? ? ? ? printf("\n");
? ? ? ? ? ? printf("退票成功\n");
? ? ? ? ? ? printf("\n");
? ? ? ? for (int i = 0; i < j; i++) ?//打印字段
? ? ? ? ? ? printf("%10s\t", field[i]);
? ? ? ? printf("\n");
? ? ? ? ? ? a = a - 1;
? ? ? ? ? ? itoa(a, column[6], 10);
? ? ? ? ? ? sprintf(query, "update testtable set 已訂票人數(shù)='"); //執(zhí)行查詢語句,這里是查詢所有,user是表名,不用加引號,用strcpy也可以
? ? ? ? ? ? strcat(query, column[6]);
? ? ? ? ? ? strcat(query, abc);
? ? ? ? ? ? strcat(query, cc);
? ? ? ? ? ? strcat(query, n);
? ? ? ? ? ? strcat(query, abc);
? ? ? ? ? ? mysql_query(&mysql, "set names gbk"); //設(shè)置編碼格式(SET NAMES GBK也行),否則cmd下中文亂碼
? ? ? ? ? ? mysql_query(&mysql, query); ? ?//執(zhí)行SQL語句
? ? ? ? ? ? printf("%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\n", column[0], column[1], column[2], column[3], column[4], column[5], column[6], column[7]); ?//column是列數(shù)組
? ? ? ? }
? ? ? ? ? ??
? ? ? ??
? ? }
? ? printf("\n");
? ? printf(" ?1 繼續(xù)售票/退票;2 返回主界面\n");
? ? printf(" 請輸入您的操作: ");
? ? ? ? cin >> y;
? ? ? ? if (y == 1)
? ? ? ? {
? ? ? ? ? ? piao();
? ? ? ? }
? ? ? ? else if (y == 2)
? ? ? ? {
? ? ? ? ? ? mainmenu();
? ? ? ? }
}
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
C++超詳細(xì)講解貪心策略的設(shè)計及解決會場安排問題
為了更好的應(yīng)對《算法設(shè)計與分析》這門課程,我把書上以及老師講過的案例都詳細(xì)的做一個重現(xiàn)及解剖,讓你熟記每一個潛在的考點(diǎn),希望能給大家?guī)椭?/div> 2022-05-05
Linux系統(tǒng)下如何使用C++解析json文件詳解
JSON(JavaScript Object Notation, JS 對象簡譜) 是一種輕量級的數(shù)據(jù)交換格式。下面這篇文章主要給大家介紹了關(guān)于Linux系統(tǒng)下如何使用C++解析json文件的相關(guān)資料,需要的朋友可以參考下2021-06-06
VS2019使用Windows桌面應(yīng)用程序模塊創(chuàng)建Win32窗口
這篇文章主要介紹了VS2019使用Windows桌面應(yīng)用程序模塊創(chuàng)建Win32窗口,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-04-04
Qt編寫地圖之實現(xiàn)經(jīng)緯度坐標(biāo)糾偏
地圖應(yīng)用中都涉及到一個問題就是坐標(biāo)糾偏的問題,這個問題的是因為根據(jù)地方規(guī)則保密性要求不允許地圖廠商使用標(biāo)準(zhǔn)的GPS坐標(biāo),而是要用國家定義的偏移標(biāo)準(zhǔn)。本文將詳細(xì)講解如何在Qt中實現(xiàn)經(jīng)緯度坐標(biāo)糾偏,需要的可以參考一下2022-03-03
C語言實現(xiàn)校運(yùn)動會項目管理系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了C語言實現(xiàn)校運(yùn)動會項目管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-02-02最新評論

