Files
gpd-925-en/CPlusPlus/Intro/main.cpp
T
2026-09-29 22:09:02 +02:00

49 lines
922 B
C++

#include <iostream>
using namespace std;
int main()
{
// console output
std::cout << "Hello, World!" << std::endl;
std::cout << 1234 << std::endl;
std::cout << "Another test!\n";
cout << "It is also working without std::" << endl;
int number = 10;
cout << "number: " << number << endl;
// cout << L"This is a wide character string, but it is not supported by cout." << endl;
// console input
cin >> number;
cout << "number: " << number << endl;
char c;
cin >> c;
cout << "c: " << c << endl;
cin >> c >> number;
cout << "c: " << c << endl;
cout << "number: " << number << endl;
// boolean
bool b = 1; // 0 -> false, anything else -> true
cout << "b: " << b << endl;
if (number != 0)
{
// true
}
else
{
// false
}
// zero-terminated string
const char str[] = "Hello";
return 0;
}