第三章——分支程序设计

1.if与最近的else配对, else if后面用花括号

2.if语句

3.switch语句

4.生成随机数:
#include <iostream>
#include<ctime>
#include<cstdlib>
using namespace std;

int main()
{   srand(time(NULL));

   int r;
   r=rand()%4;
   cout<<r;

    return 0;
}


猜你喜欢

转载自blog.csdn.net/weixin_42183904/article/details/80294812
今日推荐