variables.cpp
Server-Architecture-Firmware/variables.cpp
#include <iostream>
#include <string>
using namespace std;
int main() {
// Integer variable
int age = 25;
// Floating-point variable
float height = 1.75;
// Character variable
char grade = 'A';
// Boolean variable
bool isStudent = true;
// String variable (C++ string class)
string name = "Alice";
cout << "Name: " << name << endl;
cout << "Age: " << age << " years" << endl;
cout << "Height: " << height << " meters" << endl;
cout << "Grade: " << grade << endl;
cout << "Is a student: " << (isStudent ? "Yes" : "No") << endl;
return 0;
}
相關文章
Armstrong.cpp
Armstrong.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/Armstrong.cpp).
閱讀文章 →MaxOfTwo.cpp
MaxOfTwo.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/MaxOfTwo.cpp).
閱讀文章 →RTTI.cpp
RTTI.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/RTTI.cpp).
閱讀文章 →console_input.cpp
console_input.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/console_input.cpp).
閱讀文章 →function.cpp
function.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/function.cpp).
閱讀文章 →main.cpp
main.cpp — cpp source code from the Server-Architecture-Firmware learning materials (Server-Architecture-Firmware/main.cpp).
閱讀文章 →