Created
November 26, 2020 07:39
-
-
Save mattsegura/989f34aec6237bc39dddb6b0a019759a to your computer and use it in GitHub Desktop.
simple array program demonstration, using string array and taking input from an array integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main() | |
{ | |
string myArray[3] = {"red", "blue", "orange"}; | |
int numArray[5]; | |
cout << myArray[0] << " "; | |
cout << myArray[1] << " "; | |
cout << myArray[2] << " "; | |
cout << "\nEnter 5 numbers: \n"; | |
cin >> numArray[0] >> numArray[1] >> numArray[2] >> numArray[3] >> numArray[4]; | |
cout << numArray[0] << " " << numArray[1] << " " << numArray[2] << " " << numArray[3] << " " | |
<< numArray[4] << "\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment