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

用vs2008做网站教程seo推广网址

用vs2008做网站教程,seo推广网址,简约网页设计,动态图表制作软件《C游戏编程入门》第1章 类型、变量与标准I/O: Lost Fortune 1.1.1 使用C编写游戏1.1.2 生成可执行文件1.1.3 错误处理 1.2 第一个C程序01.game_over.cpp01.game_over2.cpp01.game_over3.cpp 1.4 使用算术运算符01.expensive_calculator.cpp 1.5 声明和初始化变量01.game_stats… 《C游戏编程入门》第1章 类型、变量与标准I/O: Lost Fortune 1.1.1 使用C编写游戏1.1.2 生成可执行文件1.1.3 错误处理 1.2 第一个C程序01.game_over.cpp01.game_over2.cpp01.game_over3.cpp 1.4 使用算术运算符01.expensive_calculator.cpp 1.5 声明和初始化变量01.game_stats.cpp 1.6 使用变量进行算术运算01.game_stats2.cpp 1.7 使用常量01.game_stats3.cpp 1.8 Lost Fortune01.lost_fortune.cpp 1.1.1 使用C编写游戏 原因 一、高速。高性能。 二、灵活。包括面向对象编程的多范型语言。 三、良好支持。大量资源库可使用图像API、2D、3D、物理以及声音引擎。 1.1.2 生成可执行文件 编辑器-源代码-编译器-目标代码-链接器-可执行文件 1.1.3 错误处理 类型 一、编译错误。语法错误应修复警告。 二、链接错误。无法找到外部引用调整引用关系重新编译/链接。 三、运行错误。非法操作逻辑错误等。 1.2 第一个C程序 01.game_over.cpp // 预处理器指令以#符号开头 // 包含头文件 #include iostreamint main() // 主函数 {// std名称空间//::作用域解析运算符// 所有语句以;结尾std::cout Game Over! std::endl; // 标准输出return 0; // 0表示程序正常结束 }// 注释 /* 注释 注释 */// 空白字符空格、制表符、换行符用于分隔代码块会被编译器忽略01.game_over2.cpp #include iostream using namespace std;//使用using指令int main() {cout Game Over! endl;return 0; }01.game_over3.cpp #include iostream using std::cout;//使用using声明 using std::endl;int main() {cout Game Over! endl;return 0; }1.4 使用算术运算符 01.expensive_calculator.cpp #include iostream using namespace std;int main() { //加法、加法与乘法cout 7 3 7 3 endl;cout 7 - 3 7 - 3 endl;cout 7 * 3 7 * 3 endl;cout 7 / 3 7 / 3 endl;//整数除法取整cout 7.0 / 3.0 7.0 / 3.0 endl;//除法至少一个浮点数保留小数位cout 7 % 3 7 % 3 endl;//余数cout 7 3 * 5 7 3 * 5 endl;cout (7 3) * 5 (7 3) * 5 endl;//运算符优先级return 0; }1.5 声明和初始化变量 01.game_stats.cpp #include iostream using namespace std;int main() {int score; // 变量声明double distance;char playAgain;bool shieldsUp;short lives, aliensKilled; // 变量声明score 0;distance 1200.76;playAgain y;shieldsUp true;lives 3;aliensKilled 10; // 变量赋值double engineTemp 6572.89; // 变量初始化cout \nscore: score endl; // 显示变量值cout distance: distance endl;cout playAgain: playAgain endl;// skipping shieldsUp since you dont generally print Boolean valuescout lives: lives endl;cout aliensKilled: aliensKilled endl;cout engineTemp: engineTemp endl;int fuel;cout \nHow much fuel? ;cin fuel; // 获取用户输入cout fuel: fuel endl;typedef unsigned short int ushort; // 定义新变量名ushort bonus 10;cout \nbonus: bonus endl;return 0; }// 基本类型 // bool, char, int, float, double// 类型修饰符 // short, long, signed, unsigned// 变量命名 // 字母数字下划线非数字开头非关键字 // 命名准则: // 描述性名称、前后一致、语言传统、短变量名// 根据数据使用范围选择数据类型1.6 使用变量进行算术运算 01.game_stats2.cpp #include iostream using namespace std;int main() {unsigned int score 5000;cout score: score endl;// altering the value of a variablescore score 100; // 修改变量值cout score: score endl;// combined assignment operatorscore 100; // 使用组合赋值运算符-*/%cout score: score endl;// increment operatorsint lives 3;lives; // 前置递增运算符--livescout lives: lives endl;lives 3;lives; // 后置递增运算符lives--cout lives: lives endl;lives 3;int bonus lives * 10;cout lives, bonus lives , bonus endl;lives 3;bonus lives * 10;cout lives, bonus lives , bonus endl;// integer wrap aroundscore 4294967295;cout \nscore: score endl;score; // 溢出变为0cout score: score endl;return 0; }1.7 使用常量 01.game_stats3.cpp #include iostream using namespace std;int main() {const int ALIEN_POINTS 150; // 常量经过命名的无法修改的值int aliensKilled 10;int score aliensKilled * ALIEN_POINTS;cout score: score endl;enum difficulty // 枚举类型{NOVICE,EASY,NORMAL,HARD,UNBEATABLE};difficulty myDifficulty EASY;enum shipCost{FIGHTER_COST 25,BOMBER_COST,CRUISER_COST 50};shipCost myShipCost BOMBER_COST;cout \nTo upgrade my ship to a Cruiser will cost (CRUISER_COST - myShipCost) Resource Points.\n;return 0; }1.8 Lost Fortune 01.lost_fortune.cpp #include iostream #include stringusing std::cin; using std::cout; using std::endl; using std::string;int main() {const int GOLD_PIECES 900;int adventurers, killed, survivors;string leader;// get the informationcout Welcome to Lost Fortune\n\n;cout Please enter the following for your personalized adventure\n;cout Enter a number: ;cin adventurers;cout Enter a number, smaller than the first: ;cin killed;survivors adventurers - killed;cout Enter your last name: ;cin leader;// tell the storycout \nA brave group of adventurers set out on a quest ;cout -- in search of the lost treasure of the Ancient Dwarves. ;cout The group was led by that legendary rogue, leader .\n;cout \nAlong the way, a band of marauding ogres ambushed the party. ;cout All fought bravely under the command of leader;cout , and the ogres were defeated, but at a cost. ;cout Of the adventurers, killed were vanquished, ;cout leaving just survivors in the group.\n;cout \nThe party was about to give up all hope. ;cout But while laying the deceased to rest, ;cout they stumbled upon the buried fortune. ;cout So the adventurers split GOLD_PIECES gold pieces.;cout leader held on to the extra (GOLD_PIECES % survivors);cout pieces to keep things fair of course.\n;return 0; }
http://www.zqtcl.cn/news/148977/

相关文章:

  • 南宁市两学一做网站logo设计网站官网
  • 中国建设工程造价管理协会网站查询网站开发者的设计构想
  • 华强北网站建设设计素材网站p开头的
  • 怎样让网站快速收录利用数据库修改wordpress密码
  • 网站建设群发广告词做网站首页多少钱
  • 黑彩网站建设中企动力 网站价格
  • 上海营销型网站报价深圳企业网站制作设计
  • 网站清理通知北京电商购物网站
  • 新开传奇网站180合击创建一个个人网站需要多少钱
  • 郑州建网站哪家好深圳企业网站制作公司介绍
  • 企业网站百度收录桂林网站建设价格
  • 砀山做网站的公司wordpress微视频主题
  • 免费的企业网站cms注册网站后邮箱收到邮件
  • 网站推广排名教程怀化职院网站
  • 房产门户网站模板新手做电商怎么起步
  • 成都网站建设科技公沈阳网站建设技术公司排名
  • 自建商城网站上海有哪些网络公司
  • 朋友 合同 网站制作手机网站建设服务商
  • 链接分析属于网站开发棋牌软件开发定制
  • top域名的网站搭建网站步骤
  • 个人网站建设背景和目的海南省网站
  • 山西成宁做的网站义乌网站建设优化排名
  • 东莞网站建设公司辉煌大厦阿里云服务器官方网站
  • 域名注册网站制作自己建网站需要钱吗
  • 东莞市房管局官方网站域名查询ip网站
  • 织梦模板添加网站地图温州做网站掌熊号
  • 怎样凡科建设网站建立网站的步骤
  • 模板类网站建设中国都有哪些网站
  • 深圳百度推广网站建设深圳电器网站建设
  • 响应式网站有什么区别官方app