标签:信息 c++实现 ice count stream int 姓名 cas ios
代码:
/******************************** *文件名:main.cpp *描述:小公主养成记 代码实战 *作者:li *时间:2020.1.6 *版权:www.cnblogs.com/lijitao/ ********************************/ #include <iostream> #include <iomanip> #include <ctime> #include <vector> #include <array> using namespace std; /***/ int main() { //1.为父女取名字 /** 父亲的姓名 */ string value_father_name; /** 女儿的姓名 */ string value_daughter_name; //2.为女儿录入信息(生日、星座) // 根据女儿的星座,设置游戏的基本参数(体力、智力、魅力、道德、气质) /** 女儿出生月份 */ int value_birth_month; /** 女儿出生的日期 */ int value_birth_date; /** 女儿的星座 */ string value_daughter_constell; /** 女儿的五项基本信息: 体力、智力、魅力、道德、气质 */ array<int,5> value_array_baseinfo; // 动态分配内存的数组 /** 五项基本属性名 */ array<string,5> value_array_baseinfo_names = {"体力","智力","魅力","道德","气质"}; /** 星座的二维数组 */ string constell_names[12][2] = { {"山羊座","水瓶座"}, //一月 {"水瓶座","双鱼座"}, //二月 {"双鱼座","白羊座"}, //三月 {"白羊座","金牛座"}, //四月 {"金牛座","双子座"}, //五月 {"双子座","巨蟹座"}, //六月 {"巨蟹座","狮子座"}, //七月 {"狮子座","处女座"}, //八月 {"处女座","天秤座"}, //九月 {"天秤座","天蝎座"}, //十月 {"天蝎座","射手座"}, //十一月 {"射手座","山羊座"}, //十二月 }; int choice,temp1,temp2,temp3; cout << "父亲的姓名:"; cin >> value_father_name; cout <<"女儿的姓名:"; cin >> value_daughter_name; cout << "女儿的生日(格式:月 日):"; cin >> value_birth_month >> value_birth_date; /** 各月份的跨星座日期*/ int constell_dates[] {20,19,21,20,21,22,23,23,23,24,23,22}; value_daughter_constell = constell_names[value_birth_month-1][value_birth_date / constell_dates[value_birth_month-1]]; cout << endl << "女儿的信息:" << endl; cout << "姓名:" << value_daughter_name << endl; cout << "生日:1659-" << value_birth_month << "-" << value_birth_date << endl; cout << "星座:" << value_daughter_constell << endl; if(value_daughter_constell == "白羊座" ) { value_array_baseinfo[0] = 80; value_array_baseinfo[1] = 18; value_array_baseinfo[2] = 18; value_array_baseinfo[3] = 28; value_array_baseinfo[4] = 14; } else if(value_daughter_constell == "金牛座") { value_array_baseinfo[0] = 65; value_array_baseinfo[1] = 30; value_array_baseinfo[2] = 28; value_array_baseinfo[3] = 35; value_array_baseinfo[4] = 20; } else if(value_daughter_constell == "双子座" ) { value_array_baseinfo[0] = 50; value_array_baseinfo[1] = 35; value_array_baseinfo[2] = 23; value_array_baseinfo[3] = 26; value_array_baseinfo[4] = 27; } else if(value_daughter_constell == "巨蟹座" ) { value_array_baseinfo[0] = 40; value_array_baseinfo[1] = 31; value_array_baseinfo[2] = 31; value_array_baseinfo[3] = 23; value_array_baseinfo[4] = 37; } else if(value_daughter_constell == "狮子座" ) { value_array_baseinfo[0] = 85; value_array_baseinfo[1] = 35; value_array_baseinfo[2] = 11; value_array_baseinfo[3] = 28; value_array_baseinfo[4] = 20; } else if(value_daughter_constell == "处女座" ) { value_array_baseinfo[0] = 35; value_array_baseinfo[1] = 28; value_array_baseinfo[2] = 36; value_array_baseinfo[3] = 29; value_array_baseinfo[4] = 18; } else if(value_daughter_constell == "天秤座" ) { value_array_baseinfo[0] = 42; value_array_baseinfo[1] = 33; value_array_baseinfo[2] = 25; value_array_baseinfo[3] = 24; value_array_baseinfo[4] = 32; } else if(value_daughter_constell == "天蝎座" ) { value_array_baseinfo[0] = 50; value_array_baseinfo[1] = 25; value_array_baseinfo[2] = 40; value_array_baseinfo[3] = 20; value_array_baseinfo[4] = 26; } else if(value_daughter_constell == "射手座" ) { value_array_baseinfo[0] = 57; value_array_baseinfo[1] = 31; value_array_baseinfo[2] = 25; value_array_baseinfo[3] = 26; value_array_baseinfo[4] = 29; } else if(value_daughter_constell == "山羊座" ) { value_array_baseinfo[0] = 56; value_array_baseinfo[1] = 30; value_array_baseinfo[2] = 26; value_array_baseinfo[3] = 22; value_array_baseinfo[4] = 25; } else if(value_daughter_constell == "水瓶座" ) { value_array_baseinfo[0] = 41; value_array_baseinfo[1] = 43; value_array_baseinfo[2] = 20; value_array_baseinfo[3] = 27; value_array_baseinfo[4] = 23; } else if(value_daughter_constell == "双鱼座" ) { value_array_baseinfo[0] = 41; value_array_baseinfo[1] = 40; value_array_baseinfo[2] = 29; value_array_baseinfo[3] = 25; value_array_baseinfo[4] = 23; } //3.开始游戏大循环 //游戏从1659年6月开始开始 for(int year = 1659; year <= 1659 + 7; year++) { for(int month = (year == 1659) ? 6 : 1; month <= 12; month++) { //判断本月是否是女儿的生日 if(month == value_birth_month) { cout << "本月是" << value_daughter_name <<"生日哦~" << endl; //根据用户的输入进行判断 //待写 } //显示游戏主菜单 cout << "\n 1、查看状态\n 2、安排行程\n 3、亲自谈话\n 4、存档\n 5、读档" << endl; cin >> choice; switch(choice) { case 1: //查看状态 cout << endl << "女儿的信息:" << endl; cout << "姓名:" << value_daughter_name << endl; cout << "生日:1659-" << value_birth_month << "-" << value_birth_date << endl; cout << "星座:" << value_daughter_constell << endl; //打印核心属性 cout << left; //左对齐 for(int i = 0; i < 5; i++) { cout << value_array_baseinfo_names[i] << ":" << setw(2) << value_array_baseinfo[i]; //计算实心方方框的数量 int solidCount = value_array_baseinfo[i] / 10; for(int j = 0; j < 10; j++) { if(j < solidCount) cout << "■"; else cout << "□"; } cout << endl; } break; case 2: //安排行程:一个月最多安排3个行程 { int num; break; } case 3 : break; case 3 : break; case 4 : break; default: break; } } } //4.根据各项游戏参数,判定游戏结果 return 0; }
dd
标签:信息 c++实现 ice count stream int 姓名 cas ios
原文地址:https://www.cnblogs.com/lijitao/p/12157937.html