school/cs142/lab06/array.cpp

43 lines
1.0 KiB
C++

#include <iostream>
#include <array>
using namespace std;
int main() {
array<string,16> test;
for(unsigned int i = 0; i < test.size(); i++) {
string a;
cout << i << " enter name" << endl;
cin >> a;
test[i] = a;
}
int a = 0;
cout << "i++" << endl;
for(unsigned int i = 0; i < test.size(); i++) {
cout << test[i] << "-" << i << " /";
}
cout << "" << endl;
cout << "i--" << endl;
for(unsigned int i = 15; i > 0; i--) {
cout << test[i] << "-" << i << " /";
}
cout << "" << endl;
cout << test.size() << " size of thing" << endl;
cout << "" << endl;
for(unsigned int i = 0; i < test.size(); i++) {
if(test[i] == "derek") {
a = i;
}
}
for(a; a < test.size(); a++) {
int b = a;
test[a] = test[b++];
}
cout << "something happening here" << a << " is where derek is" << endl;
for(unsigned int i = 0; i < test.size(); i++) {
cout << test[i] << "-" << i << " /";
}
cout << "" << endl;
}