General C++ Programming - February 2013 (Page 40)

Calculating interest and making nested loops not working
 
Hi guys/gals, I am having an issue with a project I am working on for class. I manage to get everything else working as required but the last part is just kill...
[2 replies] Last: what you need is a for loop for (statement 1; statement 2; statement ... (by cPlusN00b)
I cant figure out the error. please help?
 
#include <iostream> using namespace std; template <class T> void swap(T& a, T& b) {T temp=a; a=b; b=temp; } int main () { int a ={4,3,2,1,0}; fo...
[2 replies] Last: Are you getting a compile time error, or a run time error? I'm gues... (by AbstractionAnon)
Template function of a class
 
Hello, Everyone! I want to use a template function of a class. This is my code: #include "Comparison.h" #include <iostream> using namespace std; int main(i...
[2 replies] Last: ne555, thanks! (by Observer)
Prime numbers using loop
 
Hi. We were asked to make a program which displays the prime numbers within the range you inputted... like for example i entered 20 as the upper limit and 1 as ...
[6 replies] Last: Try this. #include <cstdio> #include <iostream> bool isPrime( int i ... (by hoity)
Templates Comparision
 
How do I compare two variables who do not have a predefined Type (i.e Templates). If I just do a==b it only works for integers and not for strings. Is there an...
[6 replies] Last: > I'm using the code posted by vlad above The code posted by vlad abo... (by JLBorges)
by akasya
Find, Calculate, Replace a String in a File with c++
 
Hello Community, i have a text file... with example following content: Pizza 23232 Car 44,495 Drink 3493,90494 .... .. . and so on.. no i want ...
[2 replies] Last: Bear in mind that you can't have the behavior you see with text editor... (by maeriden)
by arms4
highlight word
 
I know how to change background and words colour but is it possible to just highlight the specific words with the colour i want? Here is a simple code for it: ...
[no replies]
pass argv[] to a function, return an array
 
hi, i am trying to write some code that passes argv into a function, i know the code part works in main on its own, but im having an issue with how to pass arg...
[6 replies] Last: Its slow because you make an unneeded allocation on heap. You continue... (by closed account S6k9GNh0)
Templated Class Function, does not have a class type
 
I'm trying to template the return type for this function (component), I've looked around for example code but there doesn't seem to be any exactly like what I w...
[2 replies] Last: holy crap, I can't believe I didn't see that, thanks :] (by Zephilinox)
by arms4
Matching game help!!
 
I encountered the problem for the numbers to remain if they are a pair until the game end. I have no idea on how to do it so please anyone help!? #inclu...
[1 reply] : You have the 2D num array. int num = { {1,2,3,4},... (by cire)
by jnikko
luhn formula
 
how i create program;verifying 16 credit card using luhn formula
[no replies]
I need help In Runge-Kutta 4
 
I made a program that seems to work and runs, but I'm not sure if the output of my Runge-Kutta 4 is correct because it's not close to the outputs of the real an...
[1 reply] : I think this program is working the way it should. (by crimsonzero2)
by Zapeth
How does std::string::rfind work?
 
Hi, title is my question. I would imagine that either the string gets temporarily reversed and he searches through the reversed string starting at position zer...
[2 replies] Last: Ok well I thought the algorithm would be a standardized one. I guess ... (by Zapeth)
by arms4
void function and int function differences?
 
Recently learned how to use function but the only thing that i don't get it is when to use int and void function? int need return to initialize while void don'...
[1 reply] : Read the following article: http://www.cplusplus.com/doc/tutorial/fun... (by ajh32)
Hello C++ programmers. Silly question.
 
Hello, yesterday i started to learn c++ by myself. I wrote a simple script, it should download a setup from link i added into my pc. The main problem is that,...
[4 replies] Last: Thanks, i don't understand one place. how does if (strcmp(input,"down... (by Catfish3)
by arms4
Pairinng game info
 
well i need some info of code on how to make a pairing game just like the normal one where u guess two position if correct remain but wrong flip back until u wi...
[2 replies] Last: Here is it... I can make the whole things work now but the code will b... (by arms4)
Enqueue problem!!
 
Hey guys, This is a school project that I am starting to work at. I cannot change the main.cpp and the main.h files. The program is supposed to generally ...
[7 replies] Last: @psyclone: the queue member functions are implemented in Apothecary.cp... (by theranga)
Question on how to use memcpy
 
Hey, I am working on a project were I need to store a long long data type variable in six indexs of a char array. After playing with memcpy, I think it will wo...
[3 replies] Last: Thanks for feedback. Looks like I will go with the third snippet. (by tnjgraham)
Comparing words from two different files using fstream
 
I'm trying to input a html file and copy everything from that file to a new html file with some changes. I need to read the html file word by word and compare t...
[2 replies] Last: Thank you that worked for the most part. The only thing that doesn't w... (by tgaskey)
String find & replace
 
"C++ is a general-purpose programming language." I have to find the word "C++" and replace it with "Java" and then capitalize all letters. I have the simple out...
[1 reply] : http://www.cplusplus.com/reference/string/string/find/ http://www.cplu... (by cire)
February 2013 Pages: 1... 383940414243
  Archived months: [jan2013] [mar2013]

This is an archived page. To post a new message, go to the current page.