repl.it
@ArlanPereira/

Arrays Week 1

C++

No description

fork
loading
Files
  • main.cpp
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main() {
  std::cout << "Hello World!\n";

  vector<string> names;
  string aName;
  string aAge
  int counter = 1;
  while (counter < 3){

    cout << "Enter name: " << counter <<endl;

    cin >> aName;
    names.push_back(aName);
    counter ++;
  }
  for(int i = 0; 1 < names.size(); i++){
    cout << names[i] << endl;
  } 

  while (counter < 3){

    cout << "Enter age: " << counter <<endl;

    cin >> aAge;
    names.push_back(aAge);
    counter ++;
  }
  for(int i = 0; 1 < ages.size(); i++){
    cout << ages[i] << endl;
  } 
}