当前位置: 首页 > news >正文

多个域名绑定同一网站怎么做 废旧回收网站

多个域名绑定同一网站,怎么做 废旧回收网站,音乐网站开发教程,展厅设计施工《C游戏编程入门》第3章 for循环、字符串与数组: World Jumble 3.1 使用for循环03.counter.cpp 3.2 了解对象3.3 使用string对象03.string_tester.cpp 3.4 使用数组03.heros_inventory.cpp 3.6 多维数组03.tic-tac-toe_board.cpp 3.7 World Jumble程序03.word_jumble.cpp 3.1 使… 《C游戏编程入门》第3章 for循环、字符串与数组: World Jumble 3.1 使用for循环03.counter.cpp 3.2 了解对象3.3 使用string对象03.string_tester.cpp 3.4 使用数组03.heros_inventory.cpp 3.6 多维数组03.tic-tac-toe_board.cpp 3.7 World Jumble程序03.word_jumble.cpp 3.1 使用for循环 03.counter.cpp #include iostream using namespace std;int main() {cout Counting forward:\n;for (int i 0; i 10; i){cout i ;}cout \n\nCounting backward:\n;for (int i 9; i 0; --i){cout i ;}cout \n\nCounting by fives:\n;for (int i 0; i 50; i 5){cout i ;}cout \n\nCounting with null statements:\n;int count 0;for (; count 10;){cout count ;count;}cout \n\nCounting with nested for loops:\n;const int ROWS 5;const int COLUMNS 3;for (int i 0; i ROWS; i){for (int j 0; j COLUMNS; j){cout i , j ;}cout endl;}return 0; }3.2 了解对象 类与对象数据与函数封装。 3.3 使用string对象 03.string_tester.cpp #include iostream #include string using namespace std;int main() {// 创建string对象string word1 Game;string word2(Over);string word3(3, !);string phrase word1 word2 word3; // string对象连接cout The phrase is: phrase \n\n;cout The phrase has phrase.size() characters in it.\n\n; // size()成员函数cout The character at position 0 is: phrase[0] \n\n; // 索引获取字符cout Changing the character at position 0.\n;phrase[0] L; // 索引字符赋值cout The phrase is now: phrase \n\n;for (unsigned int i 0; i phrase.size(); i) // 循环访问单个字符{cout Character at position i is: phrase[i] endl;}cout \nThe sequence Over begins at location ;cout phrase.find(Over) endl; // find()查找字符串if (phrase.find(eggplant) string::npos) // 未找到{cout eggplant is not in the phrase.\n\n;}phrase.erase(4, 5); // 移除从位置4开始的长度为5个字符的子字符串cout The phrase is now: phrase endl;phrase.erase(4);cout The phrase is now: phrase endl;phrase.erase();cout The phrase is now: phrase endl;if (phrase.empty())//是否空{cout \nThe phrase is no more.\n;}return 0; }3.4 使用数组 存储多个相同类型的元素。 03.heros_inventory.cpp #include iostream #include string using namespace std;int main() {const int MAX_ITEMS 10;string inventory[MAX_ITEMS];//创建数组int numItems 0;//数组索引inventory[numItems] sword;inventory[numItems] armor;inventory[numItems] shield;cout Your items:\n;for (int i 0; i numItems; i){cout inventory[i] endl;}cout \nYou trade your sword for a battle axe.;inventory[0] battle axe;cout \nYour items:\n;for (int i 0; i numItems; i){cout inventory[i] endl;}cout \nThe item name inventory[0] has ;cout inventory[0].size() letters in it.\n;cout \nYou find a healing potion.;if (numItems MAX_ITEMS){inventory[numItems] healing potion;}else{cout You have too many items and cant carry another.;}cout \nYour items:\n;for (int i 0; i numItems; i){cout inventory[i] endl;}return 0; }3.6 多维数组 03.tic-tac-toe_board.cpp #include iostream using namespace std;int main() {const int ROWS 3;const int COLUMNS 3; // 创建多维数组char board[ROWS][COLUMNS] {{O, X, O},{ , X, X},{X, O, O}};cout Heres the tic-tac-toe board:\n;for (int i 0; i ROWS; i){for (int j 0; j COLUMNS; j){cout board[i][j]; // 多维数组索引}cout endl;}cout \nX moves to the empty location.\n\n;board[1][0] X;cout Now the tic-tac-toe board is:\n;for (int i 0; i ROWS; i){for (int j 0; j COLUMNS; j){cout board[i][j];}cout endl;}cout \nX wins!;return 0; }3.7 World Jumble程序 03.word_jumble.cpp #include iostream #include string #include cstdlib #include ctime using namespace std;int main() {enum fields{WORD,HINT,NUM_FIELDS};const int NUM_WORDS 5; // 单词列表以及提示const string WORDS[NUM_WORDS][NUM_FIELDS] {{wall, Do you feel youre banging your head against something?},{glasses, These might help you see the answer.},{labored, Going slowly, is it?},{persistent, Keep at it.},{jumble, Its what the game is all about.}};// 随机选择单词srand(static_castunsigned int(time(0)));int choice (rand() % NUM_WORDS);string theWord WORDS[choice][WORD]; // word to guessstring theHint WORDS[choice][HINT]; // hint for word// 单词乱序string jumble theWord; // jumbled version of wordint length jumble.size();for (int i 0; i length; i){int index1 (rand() % length);int index2 (rand() % length);char temp jumble[index1];jumble[index1] jumble[index2];jumble[index2] temp;}// 欢迎界面cout \t\t\tWelcome to Word Jumble!\n\n;cout Unscramble the letters to make a word.\n;cout Enter hint for a hint.\n;cout Enter quit to quit the game.\n\n;cout The jumble is: jumble;string guess;cout \n\nYour guess: ;cin guess;// 游戏主循环while ((guess ! theWord) (guess ! quit)){if (guess hint){cout theHint;}else{cout Sorry, thats not it.;}cout \n\nYour guess: ;cin guess;}// 游戏结束if (guess theWord){cout \nThats it! You guessed it!\n;}cout \nThanks for playing.\n;return 0; }
http://www.zqtcl.cn/news/61863/

相关文章:

  • 空间刷赞网站推广wordpress探针插件
  • wordpress 模板速度seo赚钱
  • 网站首页标题字数禁止拿我们的网站做宣传
  • 帮别人做网站 别人违法贵阳网站开发工程师招聘网
  • 好用的h5网站模板下载产品策划推广方案
  • 互联网备案查询系统合肥网站seo推广
  • 花生壳做的网站稳定吗企业专属网页
  • 网站主题有哪些内容淘宝网官方网站免费下载
  • 男朋友抱着我在教室做网站兰州做门户网站
  • 深圳做网站专业的公司南京移动网站建设
  • 做软文的网站事业单位网站建设算固定资产吗
  • 广饶网站定制找客户的软件有哪些
  • 南和县建设局黄页网站html介绍家乡网页模板
  • 江门网站建设优化怎样做网站制作团队
  • 网站建设初期的宣传扫黄除恶网站构造结构怎么做
  • 做网站开直通车广州白云做网站
  • 可以免费搭建网站吗高明区住房和城乡建设局网站
  • 济南微网站开发阿里云linux服务器搭建多个网站
  • 免费注册网站域名魏县企业做网站推广
  • 网站做的好看术语新手做外贸怎么入门
  • 网站制作关键技术影视网站建设需要学什么
  • 张家港网站设计wordpress 添加文章列表
  • 律所网站建设管理制度网站设计师工作室
  • 嘉兴高端建站公司兰州解封最新消息
  • 输入公司名字找不到公司网站佛山网红书店
  • 长春网站排名优化费用移动互联网应用范围具有以下特点
  • 佛山企业网站建设工作室微网站微网站
  • 怎么用flash做网站网站规划的缩略图
  • 宁波建设系统网站深圳 企业 网站建设
  • 盐田区网站建设如何查询网站空间