Zero Minus One Is Huge
#include <cstdio>
#include <vector>
int main() {
std::vector<int> v{10, 20, 30};
int n = -1;
std::puts(n < v.size() ? "A" : "B"); // (1)
for (int i = v.size() - 1; i >= 0; --i) // (2)
std::printf("%d ", v[i]);
std::putchar('\n');
std::vector<int> e;
long total = 0;
for (std::size_t j = 0; j < e.size() - 1; ++j) // (3)
total += e[j];
std::printf("%ld\n", total);
}
What does this program do?
Sign in to answer questions and track your progress
Sign In