 # Roller Coaster - Practice Problem

Hello - I am new to the website and I am so happy that I have found a place to actually practice solving problems and experiment with writing code. As they say …Practice makes perfect!! lol. Anyways - I just happened to click on a practice problem to try it out… “Roller Coaster”. Can anyone tell me why my code would be considered WRONG? I’m not seeing it - it compiles, it executes and produces the result. I’m dumbfounded…code is below:

// Roller Coaster.cpp : This file contains the ‘main’ function. Program execution begins and ends there.
//

int main() {
int t; int X; int H; std::cout << “Please input total number of test cases.” << std::endl; // t - X - H are as follows: Number of test cases - Heght of Chef’s son in inches - Minimum height required to go on ride.

``````std::cin >> t;
std::cout << t << std::endl;

for (int i = 0; i < t; i++) {
std::cout << "Please input height of Chef's son in inches followed by minimum height required to ride roller coaster." << std::endl;
std::cin >> X >> H;

if (X >= H) {
std::cout << "YES" << std::endl;
}

else {
std::cout << "NO" << std::endl;
}

}
return 0;
``````

}

Hey @bjansen0820 ,
Welcome to CodeChef , Actually you don’t need to print anything while taking input system will take it automatically.
Here is your modified code , always read input in this Manner only.

``````#include <iostream>
using namespace std;

int main() {
int t; int X; int H;

std::cin >> t;

for (int i = 0; i < t; i++) {
std::cin >> X >> H;
if (X >= H) {
std::cout << "YES" << std::endl;
}
else {
std::cout << "NO" << std::endl;
}
}
return 0;
}

``````
1 Like

u dont need to print anything (like:std::cout << “Please input height of Chef’s son in inches followed by minimum height required to ride roller coaster.” << std::endl;)