Assign initial value to variable of a basic type - C++ Data Type

C++ examples for Data Type:Introduction

Description

Assign initial value to variable of a basic type

Demo Code

#include <iostream>

int main()/*from   w  w w . ja va  2s.co  m*/
{
  int apple_count {15};                            // Number of apples
  int orange_count {5};                            // Number of oranges
  int total_fruit {apple_count + orange_count};    // Total number of fruit

  std::cout << "The value of apple_count is "  << apple_count  << std::endl;
  std::cout << "The value of orange_count is " << orange_count << std::endl;
  std::cout << "The value of total_fruit is "  << total_fruit  << std::endl;
}

Result


Related Tutorials