Inserting commas into test data with C

Back to Programming Languages forum

rlegat79     2014-12-07 06:53:30

The test data on the website doesn't contain commas to seperate each number individually. This can create problems in C++ when you copy and paste data into the compiler. The "Maximum of an Array" problem, for example, requires you to copy and paste 300 numbers into the array. Going through each number and placing a comma manually is very inconvenient and time consuming.

I'm new to programming so maybe there is an easier way do accomplish this which I am unaware? Perhaps you have some sugggestions, I"m using Visual Studio Express 2013 btw.

Rodion (admin)     2014-12-07 07:40:45
User avatar

There is a better approach rather than inserting data into your code directly.

Make your program reading data from the standard input. Then run program and paste the input data into console, so that your program will read them.

This way you save you from recompiling the code each time etc.

Here is an example of solution using this for "Min of Two" problem: link

Hope this can help!

Please login and solve 5 problems to be able to post at forum