Beginners - January 2018 (Page 11)

by RCane
Pointer Help - Confusion on usage
 
Hi everyone, I have a few questions about pointers and how they are used and when passing either their content or address to a function. So I guess the fir...
[2 replies] Last: int& rNumber This is not a pointer and has nothing to do with the ad... (by Peter87)
Simplifying if statement
 
So I am looking back on a tic tac toe project I worked on for a previous class, and found something that bugs me now as it did when I worked on it. It is this l...
[2 replies] Last: What I would do is.. when the user takes a turn, the square that was... (by jonnin)
Addn and SUBTRACTn
 
Can anyone tell me how to Combine Addn and SUBTRACTn in a program?
[2 replies] Last: These are the instructions I got for the project I am working on P... (by Devil King)
Help with vectors!
 
So i'm currently making a code that is supposed to carry employee data based on the users input. The user inputs data and then a new object is created that will...
[5 replies] Last: You re-create your vector every loop iteration because all of your log... (by Ganado)
Linking rooms in an adventure game.
 
So I have 4 rooms, all with unique names, descriptions and values. Now I wanna link them together through south, north, west and east. What would be the most ef...
[6 replies] Last: the most efficient way would be to have 4 pointers, for each direction... (by jonnin)
Language Tutorial
 
What version of C++ does the cplusplus Language Tutorial cover? It looks like C++13 and if so, are there plans to produce a Language Tutorial for the C++17 rel...
[2 replies] Last: It was written / updated about the time that C++11 was about to become... (by Duthomhas)
Warning final_number may be uninitialized i this function.
 
i tried to make a program that reads binary but the output is "1" at all times... why? #include <iostream> using namespace std; int main() { i...
[2 replies] Last: Thanks i fixed it by typing final number = (final_number + last_number... (by axel0313)
Creating an Array of objects and printing them
 
Hello! This forum has been awesome. It's helped me a lot. I have a problem you have probably seen before, and looking in the forums has gotten me along a lot...
[4 replies] Last: Yes sure, try this: stringstream ss("One,two,three"); // #include <... (by Thomas1965)
modulus error
 
double c = y ; if (c % 2 == 1) This gives the error message "error: invalid operands of types 'double' and 'int' to binary 'operator%'...
[2 replies] Last: what does this even mean % is an operator A binary operator take... (by Chervil)
Passing an object to a function in other class
 
Hello, I wrote a simple code of two objects-"Human" and "Orc", and in each one a function that makes them attack each other. In the "Orc" class I get an error-...
[7 replies] Last: The pre-processor goes through each *.cpp file, replacing every #incl... (by JustAMan)
Sentinel controlled loop
 
My program is supposed to accept a list of positive numbers and compute the average once the sentinel, -1, is entered. The problem I'm having is that it is addi...
[1 reply] : It's easier to use a for loop: for(;;) { cout << "Enter positive n... (by Thomas1965)
fstream skips first character
 
Hi, I'm trying to create a login-window for my 1st code, but I've encountered a weird problem. The ofstream to file skips one character of my password-string. ...
[6 replies] Last: Thank you, Andy! Your solution worked perfectly! I'm now in the proc... (by straslak)
How do I get length of pointer string
 
How do I get length of pointer string?? I have something like this but not exactly map<int, string*> list; string len2 = { "ah", "am", "eh", "ha"...
[3 replies] Last: @dhayde: excellent reply @Ganado: very useful information, I didn't se... (by jpmolinamatute)
by rezahs
another but different filling in a matrix from file
 
Hi All I searched the web for this question and tried lots of ways but none of them have worked so far. here is my problem: I have a txt file including three ...
[3 replies] Last: The main problem with your attempt is that you never allocate any memo... (by Ganado)
does not name a type
 
I have this error that i don't know how to get rid of. Some help please. Thanks in advance struct car { string marka; string model; int o...
[8 replies] Last: I have solved my problem. Thank you all! (by niksacokica)
Printing a vector
 
I have some trouble printing a vector. I tried printf and cout but no luck so far. struct car { string marka; string model; int obujam; ...
[9 replies] Last: It is solved thanks for the help. (by niksacokica)
by JayGln
New Programmer Problem solving
 
Sorry no code on this one... This question is one that I know many of beginner programmers go through. Just to give some personal information about myself t...
[2 replies] Last: Ok so i'm going back 30, maybe 40 years and there is no way I can reme... (by SamuelAdams)
Complex boost regex does not match string
 
I have the following simple program that aims to replace all lines starting with -- or with space and -- with a blank space. /* * * Read text files an...
[2 replies] Last: Duthomhas, your solution works as advertised. Thank you very much. (by konradedgar)
by darje
Deepest Node in a Given Tree algorithem
 
i have some algorithem i saw in some book how to find the deepest node in a tree i didnt quite understand how its work can someone illustriate it to me how the ...
[4 replies] Last: It is difficult to understand only several pieces of a thing. Look at ... (by Duthomhas)
by Thelps
IF statements that feature strings with the != operator.
 
Trying to write an IF statement that compares a string that contains user input with a group of specified characters framed by quotation marks (such as "y" || "...
[1 reply] : if (a != "y" || a != "Y") However, keep in mind that the condition... (by helios)
January 2018 Pages: 1... 910111213... 22
  Archived months: [dec2017] [feb2018]

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