420 Posted Topics
Re: [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] … | |
Re: [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 … | |
Re: [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 … | |
Re: [QUOTE]I have no idea what that means. :eek:[/QUOTE]caseg is probably from the UK, because "diss" is Brit-slang for "disrespect". :) | |
Re: 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. | |
Re: [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 … | |
Re: [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. | |
Re: [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]) { … | |
Re: 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 … | |
Re: What code did you try? what couldn't you figure out? | |
Re: [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++) … | |
Re: [QUOTE=jp_santu] void main(){ [/QUOTE] no, no, no! main() returns an int! :( | |
Re: 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] | |
Re: 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. | |
Re: [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 … | |
Re: [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; … | |
Re: [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 … | |
Re: [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 … | |
Re: 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 << … |
The End.