Declare and Print
Completed
Declare int year = 2026, double pi = 3.14159, char grade = 'A', bool ok = true and string name = "Ada". Print them on one line separated by spaces, with ok shown as true (use boolalpha).
Input
None.
Output
One line.
Example
Output
2026 3.14159 A true Ada
Editor
C++
Hints
boolalpha makes bools print as true/false instead of 1/0.
Solution explanation
string (from <string>) is C++'s text type - much easier than C char arrays.
Show solution
#include <iostream>
#include <string>
using namespace std;
int main() {
int year = 2026;
double pi = 3.14159;
char grade = 'A';
bool ok = true;
string name = "Ada";
cout << boolalpha << year << " " << pi << " " << grade << " " << ok << " " << name << "\n";
return 0;
}