420 Posted Topics

Member Avatar for lette

[QUOTE=lette]I've been working on this program all day and I'm so lost please help! I need to have a class that uses a 40 element array that has predicate function IsEqual, IsGreaterThan, etc and with member functions input, output, add, subtract. Is there anyway I can make this code smaller?[/QUOTE] …

Member Avatar for Bench
0
158
Member Avatar for comwizz

[QUOTE=comwizz]Why should references be used at all?? As we could always use pointers in place of them as if we change the value of the pointer , automatically the value of variable it points to is changed eg. p=&s;*p=7;[/QUOTE] I think you almost answered your own question - why use …

Member Avatar for Bench
0
156
Member Avatar for Kiba Ookami

[QUOTE=Kiba Ookami]Might I have an explination as to whats up with the change, and a point to an online tutorial thats up to date?[/QUOTE] The reason for the change is a little long-winded and boring, but it has to do with the fact that up until 1999, C++ was not …

Member Avatar for Narue
0
115
Member Avatar for caseg

[QUOTE]I have no idea what that means. :eek:[/QUOTE]caseg is probably from the UK, because "diss" is Brit-slang for "disrespect". :)

Member Avatar for Whodey
0
145
Member Avatar for caseg

The whole idea of 'for' loops is that you type the code once, and the loop will repeat it. The reason you are getting the same output multiple times is that you have the same 2 lines occurring 20 times.

Member Avatar for Bench
0
105
Member Avatar for robase

[QUOTE=robase]Could I have an hint for the buy 4 get 1 free and After 10 adult tickets[/QUOTE] Think back to primary school mathematics - Think about the calculation you would do, to work out how many free tickets you would get when you buy 10. Hint - C++ has the …

Member Avatar for Bench
0
698
Member Avatar for Acidburn
Member Avatar for rgrwalker

[QUOTE=rgrwalker]In function `int main()': 83 `Do' undeclared (first use this function) 83 expected `;' before '{' token Are the errors I'm receiving.[/QUOTE] "do" is case sensitive.. you used a capital letter D.

Member Avatar for rgrwalker
0
242
Member Avatar for osean

[QUOTE=osean]im not sure exactly what its called or how to use it.. but im guessing its used to pass over variables as arguments to a function, ive only seen it in functions with this added after it: [B],...)[/B] somewaht similar to the code below.. [code]int myfunc(char *data,const char *data2[B],...[/B]) { …

Member Avatar for osean
0
169
Member Avatar for janito2008

This isn't essential, but I'd recommend using "double" instead of "float" - the reason being that float has very low precision... you may end up with your results being incorrectly rounded... double means "double precision" - which is much more accurate [QUOTE=janito2008]//getdata gets the days absent by using call by …

Member Avatar for Bench
0
807
Member Avatar for niceguy21
Member Avatar for comwizz

[QUOTE=HackWizz]hi comwizz ;) , n hi 2 every1 else readin d reply :) . m a new member in the club.i dont get exactly wat u hve typed.... but i see in the foll code u has used j as a variable n incremented i... so look out.. /* for(j=0;j<l_no;i++) …

Member Avatar for HackWizz
0
355
Member Avatar for stackOverflow

[QUOTE=jp_santu] void main(){ [/QUOTE] no, no, no! main() returns an int! :(

Member Avatar for Bench
-1
317
Member Avatar for sixtysecasasin

the quick 'n' dirty way to display a file is totally un-C++ related. if you are on WIN32, use the MSDOS command "more", ie [CODE]system("more < asciiart.txt"); [/CODE]

Member Avatar for Bench
0
178
Member Avatar for ultra vires

unless you're running a prehistoric computer, 10000 is nothing :) you want to be thinking in terms of millions if you wish to obtain a calculatable time difference.

Member Avatar for bumsfeld
0
153
Member Avatar for Acidburn

[QUOTE=shortLived]My book of C++ programming says that, "The relational operators can be applied to variables of type string. Variables of the type string are compared character-by-character, starting with the first character" (C++ Programming: From Problem Analysis To Program Design, Malik, Page 148) Randy[/QUOTE] Correct, however, this isn't what the code …

Member Avatar for Bench
0
194
Member Avatar for Jon182

[QUOTE=Narue]> This has nothing to do with C++ since you've shown that you can do a simple string search. At this point it's a problem solving issue. I personally don't think it's terribly difficult to do this: [code] if ( strstr ( array, "hello my" ) != NULL ) ++test; …

Member Avatar for Bench
0
239
Member Avatar for Kilo

[QUOTE=Kilo] struct menuList //Define struct menuList with members { string Eggs; string BaconandEggs; string Muffin; string FrenchToast; string FruitBasket; string Cereal; string Coffee; string Tea; string price: }; [/QUOTE] What are these variables supposed to contain? I suspect that you do not want to write out your complete menu in …

Member Avatar for Bench
0
143
Member Avatar for bashi

[QUOTE=bashi]Design and implement a class hierarchy for any organization, employees. We are interested in modeling only the Managers and Faculty. Director shall be treated as a Manager. The following information for each employee needs to be captured:[/QUOTE] This is the sort of problem usually given to 1st-year students. Not to …

Member Avatar for Bench
-1
261
Member Avatar for amen

in C++, I always try to use library functions, thereby avoiding potentially haphazard loops. for example: [CODE] void FindEat(std::string in) { std::string match("eat"); if (match==in) std::cout << "Match found \n" ; } int main() { std::ifstream verbs("verbs.txt"); if (verbs) { std::istream_iterator<std::string> start(verbs), finish; std::for_each(start, finish, FindEat); } else std::cout << …

Member Avatar for Bench
0
275

The End.