Prints values in variables with appropriate labels. A few messages included and some newline characters placed where needed: - C++ Language Basics

C++ examples for Language Basics:Console

Description

Prints values in variables with appropriate labels. A few messages included and some newline characters placed where needed:

Demo Code

#include <iostream>
using namespace std;
int main()// w  ww .ja  v  a2  s .  co m
{
   char first = 'E';     // Store some character, integer,
   char middle = 'W';     // and floating-point variable.
   char last = 'C';
   int age = 32;
   int dependents = 2;
   float salary = 25000.00;
   float bonus = 5.25;
   // Prints the results.
   cout << "Here are the initials:\n";
   cout << first << middle << last <<"\n";
   cout << "The age and number of dependents are\n";
   cout << age << "   " << dependents << "\n\n";
   cout << "The salary and bonus are\n";
   cout << salary << ' ' << bonus;
   return 0;
}

Result


Related Tutorials