Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic C++ problems
#46
Imagine Wrote:I do string str = "Hello World"

Okay.
That kind of brings me back to the original std thing.

std is the namespace of the standard. You use this (std::<object>) to specify that the object comes from the standard library. When you use "using namespace std;" you're dragging the entire std namespace into your code so you wouldn't write std::<object>, rather you'd write <object> instead. This is looked down upon and I hope that they eventually teach you to stop, but for now I guess it doesn't matter.

FabledGumbo Wrote:He's using namespace std, meaning he'd just declare the variable as a string. My point is that he doesn't have any decent tools at his disposal at this point in time to solve this problem using strings.

Except he has a problem regarding it actually.

Imagine Wrote:How would I deal with:
" Consider this data sequence: "fish bird reptile reptile bird bird bird mammal fish". Let's define a SINGLETON to be a data element that is not repeated immediately before or after itself in the sequence. So, here there are four SINGLETONs (the first appearance of "fish", the first appearance of "bird", "mammal", and the second appearance of "fish").

Write some code that uses a loop to read a sequence of words, terminated by the "xxxxx". The code assigns to the variable n the number of SINGLETONs that were read. (For example in the above data sequence it would assign 4 to n). Assume that n has already been declared but not initialized. Assume that there will be at least one word before the terminating "xxxxx". "
Reply


Messages In This Thread
Basic C++ problems - by Imagine - 2012-10-03, 12:33 AM
Basic C++ problems - by FenixR - 2012-10-03, 12:37 AM
Basic C++ problems - by Imagine - 2012-10-03, 12:41 AM
Basic C++ problems - by Locked - 2012-10-08, 11:44 PM
Basic C++ problems - by MariettaRC - 2012-10-09, 12:24 AM
Basic C++ problems - by Imagine - 2012-10-23, 04:23 PM
Basic C++ problems - by FenixR - 2012-10-23, 04:45 PM
Basic C++ problems - by SaptaZapta - 2012-10-23, 04:47 PM
Basic C++ problems - by Imagine - 2012-10-23, 04:54 PM
Basic C++ problems - by SaptaZapta - 2012-10-23, 05:17 PM
Basic C++ problems - by Locked - 2012-10-23, 08:18 PM
Basic C++ problems - by Imagine - 2012-10-24, 03:57 PM
Basic C++ problems - by SaptaZapta - 2012-10-24, 04:12 PM
Basic C++ problems - by Imagine - 2012-10-24, 04:24 PM
Basic C++ problems - by SaptaZapta - 2012-10-24, 04:35 PM
Basic C++ problems - by Imagine - 2012-10-24, 04:40 PM
Basic C++ problems - by SaptaZapta - 2012-10-24, 04:46 PM
Basic C++ problems - by Imagine - 2012-10-24, 04:49 PM
Basic C++ problems - by Locked - 2012-10-24, 07:54 PM
Basic C++ problems - by Imagine - 2012-10-24, 08:29 PM
Basic C++ problems - by Locked - 2012-10-24, 08:55 PM
Basic C++ problems - by Imagine - 2012-10-28, 07:58 PM
Basic C++ problems - by SaptaZapta - 2012-10-28, 08:23 PM
Basic C++ problems - by Imagine - 2012-10-28, 08:36 PM
Basic C++ problems - by Locked - 2012-10-28, 08:55 PM
Basic C++ problems - by Imagine - 2012-10-28, 09:01 PM
Basic C++ problems - by SaptaZapta - 2012-10-28, 09:08 PM
Basic C++ problems - by Locked - 2012-10-28, 09:08 PM
Basic C++ problems - by Imagine - 2012-10-28, 09:14 PM
Basic C++ problems - by Locked - 2012-10-28, 09:23 PM
Basic C++ problems - by Imagine - 2012-10-28, 09:24 PM
Basic C++ problems - by Locked - 2012-10-28, 09:25 PM
Basic C++ problems - by Imagine - 2012-10-28, 09:29 PM
Basic C++ problems - by Locked - 2012-10-28, 09:35 PM
Basic C++ problems - by Imagine - 2012-10-28, 09:38 PM
Basic C++ problems - by Locked - 2012-10-28, 09:44 PM
Basic C++ problems - by Imagine - 2012-10-28, 09:50 PM
Basic C++ problems - by Locked - 2012-10-28, 09:56 PM
Basic C++ problems - by Imagine - 2012-10-28, 10:03 PM
Basic C++ problems - by Locked - 2012-10-28, 10:07 PM
Basic C++ problems - by Imagine - 2012-10-28, 10:18 PM
Basic C++ problems - by FabledGumbo - 2012-10-28, 10:21 PM
Basic C++ problems - by Locked - 2012-10-28, 10:25 PM
Basic C++ problems - by Imagine - 2012-10-28, 10:26 PM
Basic C++ problems - by FabledGumbo - 2012-10-28, 10:34 PM
Basic C++ problems - by Locked - 2012-10-28, 10:35 PM
Basic C++ problems - by FabledGumbo - 2012-10-28, 11:23 PM
Basic C++ problems - by Imagine - 2012-11-18, 09:50 PM
Basic C++ problems - by SaptaZapta - 2012-11-18, 10:10 PM
Basic C++ problems - by Fiel - 2012-11-18, 10:18 PM
Basic C++ problems - by Locked - 2012-11-18, 10:19 PM
Basic C++ problems - by Fiel - 2012-11-18, 10:29 PM
Basic C++ problems - by Imagine - 2012-11-18, 11:42 PM
Basic C++ problems - by Locked - 2012-11-18, 11:45 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)