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

iis发布php网站购买网站空间的方法

iis发布php网站,购买网站空间的方法,怎样建设微网站首页,如何下载免费网页模板C语言设计期末知识点附示例代码。 1. 基础语法 变量和数据类型#xff1a; int a 10; // 整型 float b 5.25f; // 单精度浮点型 double c 5.25; // 双精度浮点型 char d A; // 字符型 bool e true; // 布尔型 const int PI 3.14; // 常量输入输出…C语言设计期末知识点附示例代码。 1. 基础语法 变量和数据类型 int a 10; // 整型 float b 5.25f; // 单精度浮点型 double c 5.25; // 双精度浮点型 char d A; // 字符型 bool e true; // 布尔型 const int PI 3.14; // 常量输入输出 #include iostream using namespace std;int main() {int num;cout Enter a number: ;cin num;cout You entered: num endl;return 0; }2. 流程控制 条件语句 if (a b) {cout a is greater than b; } else if (a b) {cout a is equal to b; } else {cout a is less than b; }switch (a) {case 1: cout a is 1; break;case 2: cout a is 2; break;default: cout a is neither 1 nor 2; }循环语句 // for loop for (int i 0; i 5; i) {cout i ; }// while loop int i 0; while (i 5) {cout i ;i; }// do-while loop int j 0; do {cout j ;j; } while (j 5);3. 函数 函数定义与声明 int add(int a, int b); // 函数声明int main() {cout add(5, 3); // 调用函数return 0; }int add(int a, int b) { // 函数定义return a b; }函数重载 int add(int a, int b) { return a b; } double add(double a, double b) { return a b; }int main() {cout add(5, 3) endl; // 调用 int 版本cout add(5.0, 3.0) endl; // 调用 double 版本return 0; }递归 int factorial(int n) {if (n 1) return 1;return n * factorial(n - 1); }int main() {cout factorial(5); // 输出 120return 0; }4. 数组和指针 数组 int arr[5] {1, 2, 3, 4, 5}; // 一维数组for (int i 0; i 5; i) {cout arr[i] ; }int arr2D[2][3] {{1, 2, 3}, {4, 5, 6}}; // 二维数组指针 int var 10; int *ptr var; // 指针指向变量的地址cout Value of var: *ptr endl; // 输出指针指向的值动态内存分配 int *p new int[5]; // 动态分配一个长度为 5 的整数数组 delete[] p; // 释放内存5. 面向对象编程OOP 类与对象 class Person { private:string name;int age;public:// 构造函数Person(string n, int a) : name(n), age(a) {}void display() {cout Name: name , Age: age endl;} };int main() {Person p(John, 25);p.display();return 0; }继承 class Animal { public:void eat() { cout Animal is eating endl; } };class Dog : public Animal { // 公有继承 public:void bark() { cout Dog is barking endl; } };int main() {Dog d;d.eat(); // 基类的方法d.bark(); // 派生类的方法return 0; }多态性 class Animal { public:virtual void sound() { cout Some animal sound endl; } };class Dog : public Animal { public:void sound() override { cout Bark endl; } };int main() {Animal* a new Dog();a-sound(); // 输出 Barkdelete a;return 0; }6. 运算符重载 加法运算符重载class Complex { private:int real, imag;public:Complex(int r 0, int i 0) : real(r), imag(i) {}Complex operator (const Complex obj) {Complex temp;temp.real real obj.real;temp.imag imag obj.imag;return temp;}void display() { cout real i imag endl; } };int main() {Complex c1(5, 3), c2(2, 4);Complex c3 c1 c2;c3.display(); // 输出 7 i7return 0; }7. 标准模板库STL vector 使用#include iostream #include vector using namespace std;int main() {vectorint vec {1, 2, 3, 4, 5};vec.push_back(6); // 添加元素for (int i : vec) {cout i ; // 遍历 vector}return 0; }8. 异常处理 异常捕获#include iostream using namespace std;int main() {try {int age -1;if (age 0) {throw Invalid age!;}} catch (const char* msg) {cout Error: msg endl;}return 0; }9. 文件操作 文件读写#include iostream #include fstream using namespace std;int main() {// 写入文件ofstream outFile(example.txt);outFile Hello, World! endl;outFile.close();// 从文件读取string line;ifstream inFile(example.txt);if (inFile.is_open()) {while (getline(inFile, line)) {cout line endl;}inFile.close();}return 0; }10. 预处理器与宏 宏与条件编译#define PI 3.14#include iostream using namespace std;int main() {cout PI is: PI endl;return 0; }#ifdef DEBUGcout Debug mode endl; #endif11. 名字空间namespace 使用名字空间#include iostream using namespace std;namespace myNamespace {int x 10; }int main() {cout myNamespace::x endl;return 0; }12. 动态内存管理 智能指针#include iostream #include memory using namespace std;int main() {shared_ptrint p1 make_sharedint(10);cout *p1 endl;return 0;}
http://www.hkea.cn/news/14319248/

相关文章:

  • 济南网站建设有限公司服装定制品牌有哪些
  • 微信网站改版价格服装网站建设的目的
  • 南京网站费用网站建设产品包装设计网站找谁做
  • 网页设计技术论文seo 怎么建设网站外链
  • 合肥手机网站开发大国工匠网页制作素材
  • HTML可以做彩票网站吗投资网站
  • 做excel的网站建设新闻博客类网站要多大空间
  • 长沙精品网站制作wordpress手机上用的
  • 门户网站产品设计方案电商运营教程
  • 昆明自助建站模板编写软件
  • 一个com的网站多少钱怎么建立企业网站平台
  • ps怎样做网站设计网站和系统的区别
  • 网站建设佛山拓客科技最专业的做音乐网站
  • 怎么搭建自己的网站平台利用免费网站做SEO
  • 做网站的中文名字网站建设和运行管理办法
  • 长沙网站排名技巧如何建设一个子网站
  • 米枫网站怎么做分页杭州企业网站优化
  • 漳州网站开发去博大钱少a众筹网站怎么做推广
  • 出口网站建设方案网站找哪家做
  • 网上服装定制网站公司网站公司简介
  • 学校网站系统网站充值接口
  • 沈阳模板建站公司有哪些朋友圈广告
  • 许昌网站设计制作ios注册开发者账号
  • 深圳网站制作首荐祥奔科技网站模板模仿
  • 顺义深圳网站建设公司长沙市建设厅网站
  • 上海高端定制网站公司网站的主题有哪些
  • 砀山哪有做网站的重庆百度推广seo
  • 网站建设营销制作设计高端设计公司
  • 网站做微信链接易语言可以做网站嘛
  • 网站qq临时会话代码子目录创建网站