General C++ Programming - February 2019 (Page 2)

by namo
Overload functions to take vectors as parameters
Hello, so I had to overload virtual functions that work with linked lists so that they accept vector...
[1 reply] : This line doesn't make sense: newNode->info2.push_back(newItem.capaci... (by coder777)
Adventure game creation
How do I constantly display information that is being updated(Health bars) and not clearing it while...
[1 reply] : If you're looking for a grand vision of many separate screen areas, yo... (by salem c)
void trimArray(const char *toTrim, char *newArray)
This is my code but it is wrong // The function trimArray() is given a pointer to a character array...
[1 reply] : try something like this. if(input == 0) return 0; //null pointer inpu... (by jonnin)
String Help
how do you move the last 3 values in a string of unknown length to the beginning and add a #. for ex...
[2 replies] Last: or putting that together you get: mystring = "#"; mystring += orig.sub... (by jonnin)
Single Player Battleship
Here is the code for the 2 boards, both need to be visible when running. reate 2 boards (Player vie...
[1 reply] : Start without the randomization. Start by trying to place a single sh... (by doug4)
by frek
Return from a vector and dereference it
Hi, Why doesn't the code below work please? #include <iostream> #include <vector> using namespace...
[4 replies] Last: When you initialize p , vi has no contents, so vi.begin() is the sa... (by doug4)
by frek
How to get the user select a type
Hi, Here in this code, " ob " doesn't work after the conditions, and that's because it has been cre...
[7 replies] Last: [quote=frek]That is, for every data and function in ObT, we need its a... (by lastchance)
by frek
Get the value of binary tree nodes by iterators
Hi, We have a class btree for a C++ binary tree. bt is an object of that class and the class ha...
[2 replies] Last: In the binary tree program, we have a class called btree which appar... (by frek)
by iiAlex
The user is required to enter a character to represent the package chosen. If a character other than...
[17 replies] Last: What I meant was the 'result' is the same as size never begins with - ... (by Grime)
by H00G0
Interacting with a loop from outside its scope?
Hey guys! Following my last post on me trying to build a console GUI with SDL_2. I'm running into...
[13 replies] Last: What do you mean by it changes the local copy of thread A or B? Yes I ... (by jonnin)
If statement not working as intended
In the third sections the ifs are intended to select a monster depending on the modulo of rng, but i...
[7 replies] Last: Resolved all issues, thread closed :). (by Yuripetrocchi)
Program gone haywire when user input is a character
#include <stdio.h> void calculation(void); void menu(void); main() { int x = 0; do { ...
[2 replies] Last: Mmmm. > do scanf( "%c", &ch ) ; while( ch != '\n' ) ; Doesn't take in... (by salem c)
Switch case HW
#include "stdafx.h" #include <iostream> // i/o library #include <string> // string li...
[3 replies] Last: Please edit your post to put [cod e] tags around your code. ... (by salem c)
The following program outputs a segmentation fault (core dumped). I need help figuring out what is wrong. Thanks in advance
#include <iostream> #include <algorithm> #include <string> #include <map> using namespace std...
[6 replies] Last: Thank you all for the hints you provided. The issue was resolved after... (by mou541gf)
Hello I can't seem to figure out why my code skips over the gymmast's name, can someone help point o...
[1 reply] : I placed the comments on your code to give you an idea. Please, note t... (by chicofeo)
Do while help
In this code, when the program is repeated, it skips over the salesperson's name entry. Can someone ...
[1 reply] : Have you learned about cin.ignore() yet? I placed it in your code with... (by chicofeo)
So I made most of the code work, it's just I can't get to reentry after a negative gets inputed, it ...
[1 reply] : To validate a negative input, I would use a while loop. For example, ... (by chicofeo)
Priority Queue with heap input string and int
I got a Priority Queue implemented using heap with integers but i would now like to add a string wit...
[2 replies] Last: Do i declare this in main or in my header file? Also i don't use any f... (by TomRyan12)
Help with Increment and User Input
For my project, I need to count how many times the user has inputted the letters in Bacon/. There ar...
[1 reply] : //int RolltheDice1; char RolltheDice1; (by ne555)
by Grooth
overloading << only prints out address
I want my display method to show up, but I only get an address that the values are stored in. in...
[1 reply] : I'm saddened that that even compiles for you, because you're trying to... (by Ganado)
February 2019 Pages: 1234... 11
  Archived months: [jan2019] [mar2019]

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