C++ in the exercise ticket office
I am doing the exercise ticket office and I am wondering if there is an official solution because I think that pointers can play a part in this exercise but my solution includes only if statements(the most) Edit Here is my attempt: #include <iostream> using namespace std; int main() { int ages[5] = { 100,100,100,100,100 }; int ticket = 10; int tempAge = 0; double minAge = 100; double finalPrice = NULL; for (int i = 0; i < 5; ++i) { cin >> ages[i]; tempAge = ages[i]; finalPrice = finalPrice + ticket; for (int x = 0; x < 5; ++x) { if(tempAge < ages[x] && tempAge < minAge){ minAge = tempAge; } } } cout << finalPrice - (finalPrice * (minAge / 100)); //your code goes here return 0; } *I thought pointers would be in need but I didn't need them and don't quite understand their use (except for freeing ram after the purpose of a variable is completed)