General C++ Programming - February 2015 (Page 20)

by Ulutay
Question: Data structure
 
I was wondering when it is better to use map and when to type my own data structure. Like which one is more efficient a manually created linked list or the map ...
[3 replies] Last: I also wanted to know, what does an iterator in a map or a vector hol... (by Disch)
VERY QUICK QUESTION!!
 
How do i make the median display as a double? #include <iostream> #include <conio.h> #include <cstdlib> #include <ctime> using namespace std; int mai...
[2 replies] Last: Oh wow I knew that, totally forgot! Thank you! (by TheDMinor)
Program shouldn't count comments and blank lines
 
My program does compile and counts the number of lines of code, which is LOC: 20. My issue this, according to my code instruction it should not count comments (...
[4 replies] Last: Try this: #include <iostream> #include <fstream> #include <string> us... (by CPlahPlahLearner)
function overloading
 
this is what i did in c++ while overloading a function int add(void); //function call with void as argument int add(); //passing nothing i ...
[2 replies] Last: cool!.... (by karthik8913)
by ZPryor
Converting a string input to char
 
I am writing a program that asks the user for their gender. I know that atoi converts arrays into integers, but I need the input from the user in the form of F ...
[1 reply] : #include <string> #include <iostream> std::string getgender(char g... (by Militie)
by tsmone
Variable stuck in a loop
 
I want to create a loop that that generates a random number set and gives the user the option to run the loop again for a new number. I have that working but wh...
[2 replies] Last: You could use .h files or if you REALLY want to a global variable. (by tristan1333)
Complex if statement does not include 'NOT' Operator
 
Hello all. I'm not sure if I was some weird syntax problem or the way Ive ordered things. But a conditional statement I have created is not performing the way ...
[2 replies] Last: I did to, I guess I needed someone else to point that out. I checked i... (by SuperStinger)
Not averaging correctly?
 
My program isnt averaging correctly. #include <iostream> #include <string> #include <iomanip> #include <cstdlib> using namespace std; struct nameGP...
[4 replies] Last: THankx for both of you guys help! much appreciated! (by deckonsoul)
Compile program from c++
 
I'm trying to compile an external program from c++ using system, but its not working. It says "Undefined reference to 'main'" even though I have a main function...
[3 replies] Last: I just checked, and it does the same thing compiling assembly from gcc... (by fabtasticwill)
Embedding an EXE into my C++ compiled EXE
 
I was wondering if there is a way to to embed a program (say a game window) inside another. What I am trying to achieve is to allow my C++ application to run o...
[no replies]
Help calculating High, Low, Average for grades
 
The bottom three functions do not work. Nor are the finished to the extent. I do not know how the data members are being accessed and is only giving me the l...
[5 replies] Last: The use of vector is not necessary, but "borrowing" ideas from it is u... (by keskiverto)
by MTorp
Strategy Pattern paradox
 
I've reached some sort of paradox while writing my small game. I need an algorithm to decide the winner of the game, but it's a fairly complicated task so i dec...
[4 replies] Last: Thank you JLBorges. I already use interfaces, but since my real code i... (by MTorp)
Linked LIsts
 
I was to create a linkedlist template class to be able to learn the basic functions of the linked list. I have gone through everything, but in the test driver p...
[1 reply] : It seems to be going through an infinite loop when it runs the size()... (by dhayden)
need help
 
I need help with my code.. I can't seem to analyze this problem.. need help.. thanks!! :D #include <iostream> using namespace std; void displayTheUni...
[2 replies] Last: What Zyl said, and you used void main(). It should be int main(). I te... (by tristan1333)
MIDI bank select effect on channel 10 and default bank?
 
According to what I've read MIDI channel 10 is reserved for percussion. The soundfont 2.4 spec says bank 128 is reserved for percussion, but is the MIDI channel...
[no replies]
Can you guys help me understand this, please?
 
I am new to this website, this is my second post and I was wondering if I could have some help with this code. I am suppose to write a function that accepts as ...
[3 replies] Last: I have fixed the problem thank you! (by TheDMinor)
Day of Week Program
 
I need to write a program that tells the day of the week, month, day, year, and whether it is a leap year or not from a input of MM DD YYYY form. I'm new to pro...
[3 replies] Last: why not program yourself? that way you can input old dates like 1886, ... (by anup30)
by cosmos
why should we define a specialization std::swap?
 
according to item 25 in effective C++ 3rd. we should define a nonmember swap in the same namespace as our own class or template. but it says we still need to sp...
[4 replies] Last: thank you very much! (by cosmos)
rfind function with files help
 
I'm having trouble taking a students name from a file putting it into a string and cutting the string into first and last name. For this assignment I have to us...
[no replies]
SDL 2| Error 3221225477
 
Hello, I'm trying to learn SDL 2.0. I understand that the error has to do with trying to access memory that has not been allocated, but I am absolutely uncertai...
[3 replies] Last: Alright, I added in the code tags. @Peter87, I see what you mean, I re... (by tristan1333)
February 2015 Pages: 1... 1819202122... 26
  Archived months: [jan2015] [mar2015]

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