📜  如何在 cpp 中单行打印数组 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:47.580000             🧑  作者: Mango

代码示例1
int Grades[5] = { 3, 2, 5, 2 };

cout << "Grades: ";
for (int i = 0; i < sizeof(Grades)/sizeof(int); i++) {
    cout << Grades[i] << ", "; //minus the commas, remove (<< ", ") or to space out the grades, just remove the comma
}