Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
#include
using namespace std; int main() { int points[5] = {72, 95, 61, 88, 79}; int count = 0; int sum = 0; int max = points[0]; bool found = false; for (int p : points) { if (p > 80) { // Count count++; } sum += p; // Sum if (p > max) { // Max max = p; } if (p == 100) { // Search found = true; } } cout << "More than 80 points: " << count << "\n"; cout << "Total points: " << sum << "\n"; cout << "Best score: " << max << "\n"; cout << "Anyone with 100? " << (found ? "Yes" : "No") << "\n"; return 0; }
More than 80 points: 2
Total points: 395
Best score: 95
Anyone with 100? No