Tsallaka zuwa abun ciki
Justice Tech School

cout and cin

cout prints with << and cin reads with >>. Use "\n" or std::endl for a new line.

Example
#include <iostream>

int main() {
  int a = 3, b = 4;
  std::cout << "Sum: " << a + b << "\n";
  std::cout << std::boolalpha << (a < b) << std::endl;
  return 0;
}

Result

Sum: 7
true

Exercise

Print.

std:: << "hi";

Quiz Test

Which operator prints?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.