Beginners - April 2019 (Page 18)

Writing a single player battleship, need help with the start game
 
Trying to make it when I start the game I have to choose either 1 for new game, 2 for load game or 3 to quit program. When I type letters into the code if have ...
[no replies]
How to Read from a file
 
So I have this project that is due for my class and it involves reading from a file. I dont know how to do that, because every time it asks me for the file name...
[6 replies] Last: @Cheddar99, I did the same thing once by not researching far enough. ... (by Handy Andy)
Linked Lists and Nodes
 
How would you go about reading in a math function that has coefficients,exponents, and trig into a node from a file? Example input line from file: 3x^4 + 2tan ...
[1 reply] : In the function where you are reading from a file you coul dhave a cha... (by Zivojin)
Utilizing a vector for an inventory program?
 
This is a small section of code I have below, which is basically how to create an inventory program for beginners, which I am. In this programs case, I think,...
[7 replies] Last: Some game related store/inventory source I ran across a while back usi... (by deleted account xyzzy)
setprecision problem
 
Have a coding error i cant find the issue. currently passing by 96% - 4% off being a issue on how the final piece is coming out i think the problem is down i...
[7 replies] Last: OK, in that case I would do without the 4% as 96% is much more than ... (by MikeStgt)
Getting a munmap_chunk(): invalid pointer error, using pointers for my first time
 
I am using pointers for the first time and for the life of me I can't figure it out. #include <iostream> #include <iomanip> #include <fstream> #includ...
[3 replies] Last: The issue was the way I deleted the pointer. Thank you so much for the... (by salamxdd)
Hashing
 
Hello guys.I started practicing hashing and i am interested did anyone had contact with this kind of functions and how much are they effective.This are function...
[2 replies] Last: string one looks to be too expensive. personally I am a huge fan of ... (by jonnin)
Sorting an array
 
So I had 2 different text files with values and I had to output them into 1 result file. After I did this (I believe in a not optimal way) I have to sort them l...
[4 replies] Last: unless these are very, very large any tweaks will give only tiny bits ... (by jonnin)
by Bopaki
Not sure why Assertion fails
 
Here is the problem: Assertion failed: ! Empty( ), file C:\Martin\MalikChapter7\corrupt2.cpp, line 56 This application has requested the Runtime to ter...
[7 replies] Last: 1. You need to be creating new StackNode's, not new Stacks. 2. You nee... (by salem c)
0xC000000005 that I don't understand
 
Hello guys, I have a double pointer char **input that has its double pointer part mem allocated but its input part not mem allocated yet. Because its input pa...
[2 replies] Last: > printf("%f\n", *input ); Well, 1. %f isn't how you print a char (of... (by salem c)
expected unqualified-id before '>>' token when using Strings
 
I was just a begginer, so I want to know what unqualified-id is. I was using a string with cin functions. I am confused because I don't know what unqualified i...
[1 reply] : std::string >> human.name; This makes no sense and I can see no re... (by Repeater)
Viewing asc image (1,2)
 
Hi, I have read the data required to create a asc file image n from file and I would like to now display the image in my compiler. Is there something special...
[24 replies] Last: Thank you for sharing it. I still wonder about the variable height, de... (by MikeStgt)
References to Pointers (1,2)
 
I can't find much literature on references to pointers (probably not correct term), so I seek the advice of members on this subject. int* ptr1 = nullptr; int...
[20 replies] Last: In the example you provided, ptref is "just" a reference to the ptr... (by keskiverto)
Erasing odd array's element
 
Hey all, so I have a problem with this code that it's not working properly. I have n (how many there are numbers) and P the numbers. (in a text file). 8 50 80 ...
[19 replies] Last: #include <iostream> #include <sstream> using namespace std; void rea... (by lastchance)
Friendship, protected, setters...
 
When it comes to having access to private data, is one method considered better than other?
[1 reply] : When it comes to having access to private data, is one method consid... (by mbozzi)
Error Correction
 
It is failing for some of the test cases.But i tried my best to figured out but it did not work well.Can Anybody gives the test cases where it is going to fai...
[2 replies] Last: Same again. http://www.cplusplus.com/forum/beginner/252024/ But you d... (by salem c)
Address not consistant
 
In the following code I have printed the consistent elements from an array and their address. I want to know why the addresses are not consistent even the elem...
[6 replies] Last: It can depend on the C++ implementation and the OS. On Windows the ad... (by deleted account xyzzy)
Auto-fill(flooding) image help
 
Hi, I have a function that is taking in an int for rows and cols, and a height limiter. It's supposed to be filling up the image from that marker up to the hei...
[14 replies] Last: I'll still post the whole thing on Monday. Which Monday? ;) ... whi... (by MikeStgt)
Boundary cases?
 
Boundary cases for below code where it is going to fail?
[8 replies] Last: I think this is the best i can explain to you.Feel free to ask any ot... (by MikeStgt)
How to account for numbers/digits in file
 
My goal is to eventually read the query file, which contains docs, and then read the data file which also contains docs. Next, I need to get input from the user...
[8 replies] Last: Yes, that worked. Thanks a bunch. (by sunshine4)
April 2019 Pages: 1... 1617181920... 24
  Archived months: [mar2019] [may2019]

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