C++ Variable Prints values in variables with appropriate labels.

Introduction

A few messages included and some newline characters placed where needed:

#include <iostream>
using namespace std;
int main()//from   w  w  w.  jav a 2s .c  o 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;
}



PreviousNext

Related