1.关于C+程序结构,以下说法正确的是:()
#include <iostream>
using namespace std;
int main() {
int a = 5;
a = a + 2;
cout << a;
return 0;
}
int x = 10;
int y = x;
x = 20;
cout << y;
int a = 10, b = 3;
double c = a / b;
double b = 3.14;
auto c = a + b;
if (x > 5) {
cout << "A";
} else {
cout << "B";
int x = 0;
if (x) {
cout << "true";
cout << "false";
int x = 1, y = 2, z = 3;
if (x < y) {
if (y < z) {
if (z < x) {
cout << "C";
cout << "D";
int year = 2024;
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
cout << "leap year";
cout << "not leap year";
int a = 3, b = 4, c = 5;
if (a + b > c && a + c > b && b + c > a) {
cout << "valid";
cout << "invalid";
int x = 5;
switch (x) {
case 1: cout << "A";
case 2: cout << "B"; break;
case 3:
case 4: cout << "C"; break;
case 5: cout << "D";
default: cout << "E";
int a = 2, b = 3, c = 1;
if (a = b = c) {
cout << " " << a << " " << b << " " << c;
int sum = 0;
for (int i = 1; i <= 5; i++) {
sum += i;
cout << sum;
int i = 5;
do {
cout << i;
i --;
} while (i > 0);
for (int i = 1; i <= 10; i++) {
if (i == 5) {
break;
if (i == 3) {
continue;
for (int i = 1; i <= 3; i++) {
for (int j = 1; j <= 3; j++) {
if (i == j) {
cout << i << j << " ";
int arr[] = {10, 20, 30, 40, 50};
for (int i = 0; i < 5; i++) {
sum += arr[i];
int arr[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
cout << arr[1][1];
int arr[3][3] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
for (int i = 0; i < 3; i++) {
sum += arr[i][i];
int arr[3][3] = {0};
for (int j = 0; j < 3; j++) {
arr[i][j] = i + j;
cout << arr[2][1];
int arr[] = {5, 4, 3, 2, 1};
int max = arr[0];
for (int i = 1; i < 5; i++) {
if (arr[i] > max) {
max = arr[i];
cout << max;
sum += arr[i][j];
if (i + j == 2) {
int arr[5] = {5, 4, 3, 2, 1};
if (i % 2 == 0) {
x += arr[i];
x -= arr[i];
cout << x;
int arr[2][3] = {{1, 2, 3}, {4, 5, 6}};
for (int i = 0; i < 2; i++) {
if (arr[i][j] % 2 == 0) {
if (arr[i][j] > 4) {