Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How should I test my program on the following input strings?

1 Answer

+1 vote
answered Sep 27 by Peter Minarik (63,140 points)
When you run your application in OnlineGDB, at the bottom you can specify the command line arguments and can switch between Interactive Console and Text for standard input.

Select Text, and copy your test content there.

Assuming you'll need to read your test data from the standard input...

If not, read it from a file and put your test data in a file.

If you share some code, more specific help could be provided. :)

Good luck!
commented Oct 3 by Nirali Patel (470 points)
Yes but that's in the void function, then how should I return or terminate the program? How should I read line by line from the file? And is it fine if I share the project question with you, if you can better understand and tell me what its asking for?
commented Oct 3 by Peter Minarik (63,140 points)
"how should I return or terminate the program?"

There is an exit() command, where you can also provide an error code.

E.g.: `exit(0);` would terminate the program.

See https://cplusplus.com/reference/cstdlib/exit/ for more details.

"How should I read line by line from the file?"

That's kind of your task. :)

You can open the file and only call `getline(newfile, str)` when the user entered 'y'.
commented Oct 4 by Nirali Patel (470 points)
How can I get the character of the array{0,1,2,3,4,5,6,7,8,9}.This should also print the character . I tried doing like array[]++, but that took up to something else only. How can I print the rest of the characters with the numbers. Please help me. Thank you.
Here is the code:
https://onlinegdb.com/PX57Lx1hi
commented Oct 4 by Peter Minarik (63,140 points)
I think you could benefit from doing some tutorials.

I highly recommend doing some online search for some training. Check this out on basic data types: https://www.w3schools.com/cpp/cpp_data_types.asp

If you want to store characters, not integral numbers in an array, then do not use numeric literals, but character literals.

E.g.:

char digits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };

Again, do some online tutorials and learn the language basics:

https://cplusplus.com/doc/tutorial/
https://www.w3schools.com/cpp/
https://www.tutorialspoint.com/cplusplus/index.htm
https://www.learncpp.com/

Pick one of the above or find any alternatives and do the trainings so you'd be familiar with programming and C++ in specific as well.

Good luck! :)
commented Oct 5 by Nirali Patel (470 points)
okay, thank you for the help
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...