C++ 代码示例:变量声明、赋值和输出
int a = 5; float b = 3.14; string c = 'Hello World'; bool d = true;
// 输出变量的值 cout << 'a的值为:' << a << endl; cout << 'b的值为:' << b << endl; cout << 'c的值为:' << c << endl; cout << 'd的值为:' << d << endl;
// 修改变量的值 a = 10; b = 2.718; c = '你好,世界'; d = false;
// 再次输出变量的值 cout << 'a的值为:' << a << endl; cout << 'b的值为:' << b << endl; cout << 'c的值为:' << c << endl; cout << 'd的值为:' << d << endl;
原文地址: https://www.cveoy.top/t/topic/miAQ 著作权归作者所有。请勿转载和采集!