Daily c++ problems

Pages: 12345
Good idea Need4Sleep :)

Maybe you could use those reserved posts for the various difficulties?
Actually did my own problem, and i found the myArray problem to be quite fun . I would rate it a hard personally due to the amount of time needed to complete it(one of the longest assignments ive written so far). if anyone is looking for answers to problems i've coded them all, feel free to ask.

Still looking on input for its difficulty if anyone else has tried it.
Actually did my own problem, and i found the myArray problem to be quite fun . I would rate it a hard personally due to the amount of time needed to complete it(one of the longest assignments ive written so far). if anyone is looking for answers to problems i've coded them all, feel free to ask.

Still looking on input for its difficulty if anyone else has tried it.


Could you share your Roman Numeral code please?

Here is my attempt: http://pastebin.com/g7rcivfh

Very new to C++ and have never used classes before. I wish my Accelerated C++ book would hurry up!

What would you change about my code?
Last edited on
closed account (17pz3TCk)
I've only had time to do the remove vowel program so far(very good problem for a beginner program I think) but I love the idea of this thread. I need to get comfortable with C++ after only learning Java in school and these exercises are a fantastic way to get into it. Can't wait to see the ideas you come up with Need4Sleep.
Really enjoyed the newest one!

http://pastebin.com/fCiqcBNU is my attempt, any comments?
I think this one is interesting~

Here is my code:

http://pastebin.com/4fN2M6k8
my solution for the problem on 7/21/2012
http://pastebin.com/GeSGgWyh

I did not find any answer, so I post mine

my solution for the problem on 7/21/2012
http://pastebin.com/GeSGgWyh

I did not find any answer, so I post mine


Ill be sure to add you, thanks for the share!


Really enjoyed the newest one!

http://pastebin.com/fCiqcBNU is my attempt, any comments?


looks great! ill add you to the answer thread and give credit where due.

Updated with a new problem

answer thread updated
Last edited on
Hey just finished the airplane one:

http://pastebin.com/YkLCMjng

Not as challenging as the others have been, but great practice non the less!

Please keep updating!


Anyone got any improvements for my code? Would appreciate input.
Last edited on
it gives me a hard time to output the seat in an decent order, i finally used setw() to make it. I know this is not the key point of the problem, but I learned something new. Great practice~
Thank you @Need4Sleep

http://pastebin.com/dxCy1HpJ
Appreciate you guys posting your code to help with the answer thread.

as for speakon, your code leads a reader on a maze type trail. You usually dont want to have functions lead to other functions like so:

void functiona(int a)
{
      do code;
      functionb();
}

void functionb()
{
       stuff;
       anotherfunction();
}


this type of program structuring can lead a reader on a chase to find a desired part of the program and can be extremely difficult to track down errors. I would refrain from using so many functions in your code.Try to simplify the code while still keeping an organized group of specific functions, as what wnan42 did. Although you were first to post, wnan has a more organized and easy to understand code, so ill be using his in the answer thread.


EDIT: i still cringed at your system("pause") at the end wnan42, it pains me to see that line.
Last edited on
@Need4Sleep
7/32/2012?
@Need4Sleep
EDIT: i still cringed at your system("pause") at the end wnan42, it pains me to see that line.


Ok, I am going to delete that line. I know it is not a good habit to keep this line in the code. Thanks for your comments. And big big thanks to your daily problems!!!
Last edited on
The 2D array reversing was a great exercise but im not a very good programmer and i found it pretty easy. You should rate Intermediate instead in my opinion.
Last edited on
Updated with the last problem i post until i leave for a little bit. I tried to give you guys a problem that was hopefully hard enough to leave you thinking and baffled for a couple days(probably wont be the case). I also appreciate all the feedback in getting, keep it coming!
Any comments on this code for the first string problem? I'm at work so haven't been able to compile and test it yet :D

http://pastebin.com/2f0f27Ty
@baexie
Try http://ideone.com I do see quite a few syntax errors.
Last edited on
I updated my code but there is still an error on line 56 that i can't figure out what is wrong...

http://pastebin.com/2f0f27Ty

The error i get is
prog.cpp:56: error: invalid conversion from ‘int’ to ‘const char*’
prog.cpp:56: error: initializing argument 1 of ‘std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = std::allocator<char>]’
Change the ternary to an if else. You also need to fix the condition on line 37.
Pages: 12345