Stores a few values in three variables, then prints the results: - C++ Language Basics

C++ examples for Language Basics:Variable

Description

Stores a few values in three variables, then prints the results:

Demo Code

#include <iostream>
using namespace std;
int main()//from ww w  .j a va 2s. 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 = 1.25;
   // Prints the results.
   cout << first << middle << last;
   cout << age << dependents;
   cout << salary << bonus;
   return 0;
}

Result


Related Tutorials