Using the cin and cout Objects with Arrays : Array « Data Structure « C++






Using the cin and cout Objects with Arrays

Using the cin and cout Objects with Arrays
 

#include <iostream>
using namespace std;

const int MAX = 3;

int main ()
{
   char grades[MAX];
   for (int i = 0; i < MAX; i++)
   {
      cout << "Enter grade for test #" << i + 1 << ":";
      cin >> grades[i];
   }
   return 0;
}


           
         
  








Related examples in the same category

1.Using a Variable Pointer to Point to an ArrayUsing a Variable Pointer to Point to an Array
2.Array InitializationArray Initialization
3.Assigning and Displaying Array ValuesAssigning and Displaying Array Values
4.cin and cout work with char arraycin and cout work with char array
5.Outputs addresses and values of array elements.Outputs addresses and values of array elements.
6.To input numbers into an array and output after.To input numbers into an array and output after.
7.Array based on int pointer