General C++ Programming - April 2013 (Page 9)

What is going on with this "simple" code???
 
No matter how I rewrite it, I can't get the sqrt function or even the pow function to make a legitimate DOUBLE output! I swear, when I originally submitted this...
[1 reply] : Your function declares that it returns an int. (by LB)
by CPDubs
stl list item not removing
 
Im making a go fish card game and i have this function to remove a card from one deck and add it to another. I have it going through the list of the loser (the ...
[5 replies] Last: And note that you cannot continue iteration after this, because you wi... (by MiiNiPaa)
by ljs
template instanciation
 
Dear all, I have a probkelem with a template function. I have 2 classes: Base and SpecializationClass. I also have a template function of which i made one ins...
[2 replies] Last: that is a pity, because I wanted to make more specialization classes a... (by ljs)
Control ofstream output field width
 
Hi, I have to output a series of data, I have to control the width of parts of my data. like following: double a = {1.0, 2.0, 3.0}; double b = {1.5, 2.5, 3...
[5 replies] Last: Look at their documentation. They modify "state". Therefore: 1. Stor... (by keskiverto)
Using Index in Arrays
 
Hello. I am a beginner in c++ and I was confused as to how to use the indexOfMax function in my code to find the maxVotesIndex. Also, i can't get the percentVot...
[8 replies] Last: If you don't need a variable, then remove it completely. (by keskiverto)
between 2 dates
 
does anyone know how to search and display the total between 2 days without using lots of code
[3 replies] Last: thanks but not sure if that is what I need be able to input date 2 dat... (by Allan Walls)
Access violation problem
 
Trying to finish this last project so I never have to program again but I can't seem to find the error with this code, I've run the debugger but I can't tell wh...
[4 replies] Last: There's probably a lot more wrong with this file. I'm just pointing ou... (by Computergeek01)
how to solve this?
 
Write your question here. Approximating the square root Implement the sqrt function. The square root of a number, num, can be approximated by repeatedly p...
[2 replies] Last: numGuess???? nextGuess = (lastGuess + (num/lastGuess)) /2 #include ... (by CroCo)
PAssing strings from C++ to FORTRAN
 
I'm trying to pass a string from c++ to FORTRAN. Can anyone advise how to do this?
[2 replies] Last: Don't forget to mention which compilers you're using, the approach ... (by Cubbi)
by Jijgee
LPCWSTR, string
 
...
[no replies]
Bubble Sort/Selection Sort
 
Bubble Sort/Selection Sort
[3 replies] Last: Those look sorted to me :) (by shacktar)
Control execution of code block by entry
 
Hi, I have a program including several code blocks in the following simplified structure: int main() { // block A if(a > 0) { } // bl...
[4 replies] Last: Do not use goto. It messes up program order and this is clearly not th... (by MiiNiPaa)
Number required after Prime Numbers addition
 
I have to write a code in which the addition of prime number gives the number user input.. for example if user enters 10 then 7+3 = 10 2+3+5 = 10
[2 replies] Last: The only thing I cannot understand is that how to make those pairs oth... (by Xnheritance)
Segmentation Fault.
 
#include <iostream> #include <fstream> #include <string> #include <vector> #include <sstream> #include <algorithm> #include <iterator> #include "matrix_...
[1 reply] : Check count of parameters before using them. It leads to segfault if I... (by MiiNiPaa)
+ operator with reference parameters can not be chained
 
Hi! this doesn't compile: class myclass{}; myclass operator+(myclass &a, myclass &b){ return a; } myclass a,b,c,d; d = a+b+c; when I change...
[1 reply] : myclass operator+( const myclass &a, const myclass &b){ ... (by MiiNiPaa)
Input and Output array using function
 
I want to create a function that will accept input from the user and return the input, to be used for further calculation. I know how to accept and return with ...
[3 replies] Last: An array argument is actually passed by reference Pointer to the firs... (by MiiNiPaa)
by packy
string
 
I want to create 2 functions to (1) convert a passed string into proper case (capitalize the first alpha character of a string and every alpha character that fo...
[2 replies] Last: 1) If you don't mind C++11: #include <string> #include <algorithm> #i... (by MiiNiPaa)
C printf() issue
 
The following code crashes the process. Does anyone know why? #include <stdio.h> int main(int argc, char* argv) { printf("%s", argv ); } ...
[2 replies] Last: Thanks. Stupid mistake... :) Some rest is in order. (by aaronfjerstad)
Cannot cast from void pointer: returns always error C2440
 
Hello everybody, I having a problem which I'm not able to resovle. I try to dereference a void pointer but I always get a C2440 error. It says: 'static_cast'...
[3 replies] Last: Thank you so much. This did the job: wqueue<Soundfile*>* m_queue= ... (by dawansch)
Can anyone help me see why my pointer function is not working properly?
 
My professor tells me that my "push_back" is not working and I get a memory error after entering a 2nd course because X's "next" pointer is uninitialized. I'm a...
[10 replies] Last: Any tips would be greatly appreciated I still am unable to get the dis... (by ovaltine99)
April 2013 Pages: 1... 7891011... 53
  Archived months: [mar2013] [may2013]

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