#include <iostream> using namespace std; int main() { int x = 5; int y = 6; int sum = x + y; // Integers (whole number) int age = 21; int year = 2023; int days = 7; int hours = 4.5; //this is able becuase int only contains whole number. The outpute would be 4 not 4.5 // double (number including decimal) double price = 10.98; double gpa = 2.5; double temperature = 25.1; // char (single character) char grade = 'A'; char intitals = 'B'; char currency = '$'; // booleen (True or false) bool student = false; bool power = true; bool forSale = true; // stirng (objects that represents a sequence of text) std::string name = "bro"; std::string day = "Friday"; std::string food = "Pizza"; std::string adress = "123 fake st."; cout << "Hello " << name; cout << "You are " << age << " years old"; return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter