Search
 
SCRIPT & CODE EXAMPLE
 

CPP

taking input from user in array in c++

int numbers[5];

  cout << "Enter 5 numbers: " << endl;

  //  store input from user to array
  for (int i = 0; i < 5; ++i) {
    cin >> numbers[i];
  }

  cout << "The numbers are: ";

  //  print array elements
  for (int n = 0; n < 5; ++n) {
    cout << numbers[n] << "  ";
  }

  return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: delete specific vector element c++ 
Cpp :: cpp infinity 
Cpp :: note++ 
Cpp :: BMI Calculator Program in C++ 
Cpp :: qlabel set text color 
Cpp :: #pragma once in main file what is it for 
Cpp :: reading in lines from a file to a vector c++ 
Cpp :: quotation in c++ string 
Cpp :: std string to const char * c++ 
Cpp :: math in section title latex 
Cpp :: c++ print to standard error 
Cpp :: minimum and maximum value of a vector in C++ 
Cpp :: OPA in expanse 
Cpp :: cmath sqrt 
Cpp :: c++ initialize array with all zeros 
Cpp :: how to run a c++ program in the background 
Cpp :: how to add numbers in c++ 
Cpp :: default access modifier in c++ 
Cpp :: unordered_map header file c++ 
Cpp :: srand() c++ 
Cpp :: how to do nCr in c++ 
Cpp :: c++ string to int conversion 
Cpp :: c++ check if vector is sorted 
Cpp :: binary file in c++ 
Cpp :: all data types in c++ 
Cpp :: how to scan array in c++ 
Cpp :: how to erase a certain value from a vector in C++ 
Cpp :: how to send email in c++ program 
Cpp :: c++ remove last character from string 
Cpp :: indexing strings in c++ 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =