~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The cause of the problem has already being mentioned by Walter:

Your input is storing the ENTER or the newline character you typed at the end of the word in the variable. You just need to remove the newline at the end . Use strlen() to help find the end of the value and replace the '\n' with '\0'

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello Malcolm, welcome to Daniweb. :D

I have requested your thread to be moved to the appropriate forum, so that you can get the maximum help.

And don't worry, we do have a lot of members with 50+ of age -- its never too late to start something.... ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get to clean up the mess caused by the storm.

I put in a shoe.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Numbers like 1 and 19884 are int, numbers like 3,1415 and 0,0134 are float.

That would be 3.1415 and 0.01345 -- it was probably a typo by Nick.

You should read up on a lot of C, because if you don't know these basic things, Classes and OOP will be allmost impossible to understand.

As such no need to look up onto C. The basics of C and C++ are the same -- pointers, memory management, data types, structs, enums and the likes. C++ is what they call a functional superset of C.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

saw that his

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

With the same excuse evertime, you won't get far in this game.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

exams -> sucky

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This is because erase call expects both the parameters to be iterators while in your first line you have called the erase function with an integer argument. Make appropriate change to the second argument of your first line to an iterator and it should be fine.

*Hint: Use the same trick you used in the second line. *

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Heavily mutated corpses are DYING over fractal contusions, debunked.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You get a household cat.

I put in a storm

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Minor nit, ~s.o.s~, the initial examples by the OP were expressions and not declarations.

Oh didn't read the question properly, assumed that it dealt with declarations -- thanks for pointing out the blunder.

Anyways considering he is a beginner, the link is a good read nonetheless. ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

the cloudless sky.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Terrorists are among us, its only that they have mingled so well with the society, its difficult to spot them.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

to maintain the

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

parties -> hangover

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Consider putting a continue statement after the user enters a non digit character since there is no point in peforming undue looping when you know you haven't stored the character anyways...

And btw, consider improving on your code indentation, would really make the code more readable. Try not putting the opening and closing braces on the same line.

Don't do something like: if( condition ) { break ; } Something like this would be more like it:

if( condition )
{
     break ;
}
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Graphics as in GUI libraries ? If so then this and this are worth checking out.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

C++, I have heard many say, is a functional superset of C, so most of what you learn in C++ is very much applicable to C.

Though if you had started with C, the ad hoc style of coding which ensues when a beginner normally starts programming would have been difficult to unlearn, resulting you in writing C code using C++. But if you start off with C++, no such issues ( you can't write C++ code as it is in C). Starting off with C++ would be a good idea.

And btw, the kind of books you choose play an important role in the way you develop your programming skills and knowledge base, so be picky and choose the best after thorough research.

Some really good books by Mr. Dave Sinkula are mentioned here.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Given your problem domain and your language exposure, Java would be better than C++.

It has lot of inbuilt and handy classes which shift the task of implementing the trivial functionalities from you. An inbuilt GUI support ( Swing and AWT ) would really simplify matters specially when GUI in C++ is really *tough* not to mention you will have to resort to some third party packages or go with Windows programming ( both are hellish ).

That being said Java, C# and Python (recommended if you are up for it ) would be more like it especially if you don't as such know C++.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe this will help you out.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though other people might have different views on this, here is what I personally think :

* I can do system programming with
* I can build a compiler with
* I can use to fool around with the Linux Kernel
* I can program my own Linux distro in
* I can start an OS from scratch with

That would be C, though C++ has started to creep in this area considering the increasing complexity of these programs. Core linux kernel written in C. Most parts of Python and Perl are implemented in C. Core windows kernel again made in C.

* I can program nice GUIs with
* Is pretty easy to learn (ie. not Assembly )
* and that preferably has a lot of resources for learning...

That would be C++ . Most GUI libraries I have seen have been implemented in C++ and for C++. Lot of C++ resources on the internet and is pretty easy to learn considering the added abstraction and STL incorporation in C++ standards.

Oh I btw, don't let someone kid you into believing C is dead -- because it isn't ( the same goes with Lisp ).

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Fantastically mutated corpses are SLAYING over fractal contusions, debunked.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Poems are one of the many things I am not good at.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

There's not really much we can do about it, though.

Actually there is a way.

The moderators have to just replace the code tags and it should turn out to be fine.

If you will again look at the first post of the thread under consideration, it was edited by me and now it looks relatively okay.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

we should stay

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

omniously, like a

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

religious -> social

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Splitting it off would be a good idea -- C and C++ are not the *same* languages, a misconception harbored by many.

But then again, the previous discussion in the Moderators section was not fruitful since the danger of C forum starving always loomed, a thing which probably isn't the case at present considering the kind of traffic on Daniweb.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I bet you that will peeve off a lot of regular members.

No, it won't, as long as you have something useful to contribute.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes -- not to mention the copy and pasting of code from my IDE to the WYSIWYG window results in scroll bars even when the 80 column limit is respected.

It would be nice if the changes were done, though have managed it till now, so wouldn't be a problem if a decision was made against it....

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

of the trouble

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

continue and break are two of the many keywords of C++.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Fantastically mutated CORPSES are slaving over fractal computations, debunked.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

japan -> anime

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

but alas, I

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

cat -> feline

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

phat -> fat

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Variable length array declarations are illegal in both languages. You must be relying on some compiler specific extension.

I guess they are valid according to the C99 standard ( 6.7.5 ), but only when they have automatic storage duration....

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

It would have been better if you would have just attached the txt file along with the post. It would save us the trouble of running one extra program esp so when the program is in a foreign langauge.. ;)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The way you are defining the functions is incorrect. It should be

'write like this
public function func1( )
   msgbox "hello"
end function

'and not this way, the below one is incorrect

public func1( )
   msgbox "Hello"
end function

After this change it should work out fine.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Relaxing time away from the office -> laziness

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

gimme ze codez asap pronto plz, iz very extremely urgent!!!!!

That's probably the reason...

:mrgreen:

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

You can:

  • create an array of 5 elements (either statically or on the fly )
  • run a loop which will generate random number
  • search whether that random number is already in the array
  • as long as the number is one present in the array, keep on generating random numbers.
  • If no match is found, insert that number into the array.
  • Keep doing this till all the array slots are filled with random numbers.

Though the method is a bit ad hoc ( searching the entire array each time a random number is generated is bit too much) but should suffice your purpose.

Also why is your random generation method so complicated... Why not do something simple as: random_number = min + rand( ) % max ; This will generate random numbers between minimum and maximum, both inclusive.

Also for permutation purpose, you can try here... Though the algorithm is for permutation of character arrays, you can easily adapt it for integer ones.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

distance -> destination

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hello.

I don't think this is a good idea. The C/C++ forum is visited by a lot of newbies which don't have a clue that there's a difference between C and C++. So what you'll get is a lot of extra work for the moderators and a lot of 'moved to the [...]forum' posts.

Yes, considering 90% of people frequenting C / C++ forums come for a quick fix, I don't think they would even bother seeing where they are posting -- not to post most of them don't even know whether they are dealing with C or C++.

Now I don't know the exact stats, but I would say that 75% of the newbie posters ignore this rule.

Aren't you being a bit optimistic....I would say um.. 95% don't use code tags properly.

Not a bad idea. Splitting has worked on other forums I deal with.

I wonder who would agree to do this ardous task.... ;) But seriously there are two options:

  • Either start seperating the threads in the forums into catergories i.e. C or C++, which I guess is really time consuming
  • Mark all the current threads as that belonging to C++ and create a new C forum.

Thank you.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

strange -> range

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Horrifically-scarred, miners are slaving over fractal COMPUTATIONS, debunked.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Kalani -> Weird

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

, about my heart.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

so its better