函数的定义语法:返回值类型 函数名 (参数列表) {函数体 return表达式}#include <iostream>
#include<iomanip>
#include<cmath>
using namespace...
阅读全文...
C++-11-跳转语句
break语句用于跳出选择结构或者循环结构使用时机:出现在switch条件语句中,作用是终止case并跳出switch出现在循环语句中,作用是跳出当前的循环语句出现在嵌套循环中,跳出最近的内层循环语句#include <iostream>
#...
阅读全文...
阅读全文...
C++-10-循环语句
while语句语法:while(循环条件){循环语句}只要循环条件为真就会执行循环语句,直到不为真时退出循环#include <iostream>
#include<iomanip>
using namespace std;
i...
阅读全文...
阅读全文...
C++-9-三目运算符和switch语句
三目运算符表达式1?表达式2:表达式3当表达式1为真时,执行并返返回表达式2,否则执行并返回表达式3#include<iostream>
using namespace std;
int main()
{
cout << ...
阅读全文...
阅读全文...