Skip to content

Instantly share code, notes, and snippets.

@morontt
Created May 18, 2014 08:19
Show Gist options
  • Save morontt/a7eafb71298371bf44f4 to your computer and use it in GitHub Desktop.
Save morontt/a7eafb71298371bf44f4 to your computer and use it in GitHub Desktop.
salazar 2
#include <iostream>
using namespace std;
int main() {
int s[10];
int z;
int count = 0;
char lett;
cout << "z = ";
cin >> z;
cout << endl;
for (int i = 0; i < 10; i++) {
cout << "s[" << i + 1 << "] = ";
cin >> s[i];
}
cout << endl;
cout << "array:" << endl;
for (int i = 0; i < 10; i++) {
cout << s[i] << ' ';
}
cout << endl << endl;
for (int i = 0; i < 10; i++) {
if (s[i] > z) {
s[i] = z;
count++;
}
}
cout << "modified array:" << endl;
for (int i = 0; i < 10; i++) {
cout << s[i] << ' ';
}
cout << endl << endl;
cout << "count: " << count << endl;
cout << endl << "Enter a letter to end the program" << endl;
cin >> lett;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment