Beginners - May 2022 (Page 2)

Hi! I am a newbie at C++ and would love to have some help in solving this problem.
Whenever I include spaces in the input, the whole thing loops endlessly, I can only write one word or a sentence with no spaces. { string input; co...
[7 replies] Last: Hi guys, update! I fixed it! With all your help, though it is a simpl... (by heston987)
struct dirent *entity difference
struct dirent *entity struct dirent* entity i runned the both codes and complair didn't give any error. if both of these code true why people prefer struct ...
[13 replies] Last: p is set to nullptr (by seeplus)
Console freezes when complied.
Hi, I was told to write this code which will read text from a file, which is laid out sort of like this: Id: 4343 Name: Daniel Number: 88442939 Email: daniel@y...
[6 replies] Last: See also: (by againtry)
Hello, I'd appreaciate a code review!
As the title says, i'd like to ask for a code review. The programs works as i imagined, but i'd like to improve it, if i can in any way. The program helps you p...
[7 replies] Last: I think the single most important thing you can do is comment your co... (by George P)
recursive_directory_iterator filesystem
Hello i have issue and i can't doing and i am gonna getting crazy about that. I always taking same problem with VS Code and Microsoft Visual Studio. I checke...
[9 replies] Last: seeplus, I suspect the OP has moved on to another topic, this time muc... (by George P)
by Ch1156
SFML Help - Displaying text in a vertical order with a vector
So im trying to use a vector to display SFML text on the screen, and it works but what i need to do is get the location of the text in the last array and displa...
[6 replies] Last: Apparently sf::Text already has multiline support built in. sf::Text... (by Peter87)
CodeLite C++, can not open .exe file of the project when using iostream library
Hello I recently changed the IDE I use to CodeLite, and I seem to get a problem. I made my first testing Hello World program to test if everything is OK, and ...
[8 replies] Last: There is an alternate download site for the current Code::Blocks versi... (by George P)
for loops, is using i-- bad practice?
New to C++, I have a question about for loops that I need some help with. I understand the condition of using the for loop and how it increments/decreases but I...
[6 replies] Last: There are 3 ways to iterate through a regular array: #include <iostre... (by George P)
Reading data from text file, with commas, into a dynamic array of structs
I have no idea on how to read in this file, every method I try does not result in an output. the ret of the code works just fine the only part that doesn't work...
[10 replies] Last: #include<fstream> #include<iostream> #include<string> using namespac... (by againtry)
by Pen72
Maze (1,2)
Hi everyone, This problem is very tough for me, would be glad if there's any advice to solve it properly. There is a forest fire and you are in the forest....
[20 replies] Last: heres my take on it. Even though I just finished messing with it toni... (by markyrocks)
Has anyone seen this before?
Hello, I am studying the Bjarne Stroustrup Programming Principles and Practice Using C++ (Second Edition). I created this program to convert 3 currencies to the...
[11 replies] Last: I tend to avoid youtube since it is a classroom experience with someon... (by George P)
error: cannot convert 'LPCWSTR' {aka 'const wchar_t*'} to 'LPCSTR' {aka 'const char*'}
hello i am trying to do an file finder but i took this error i am new in c++ how could i fix this problem thanks #include<iostream> #include<Windows.h> ...
[11 replies] Last: @seeplus, I tried using "Unicode" (the default) and "Multi--byte" enco... (by George P)
STL stack: Does calling stack.pop() invalidate object?
This is from a Leetcode binary tree traversal exercise. /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left;...
[6 replies] Last: Had to check for myself Awesome! You figured out a way to test a cla... (by keskiverto)
Why isn't TreeNode destructor called?
Question in the title. I was expecting some cout output before main() exits but nothing gets printed. When Tree gets destroyed, the call free(tn) should h...
[3 replies] Last: and delete isnt really a function. its delete x; or if its a block ... (by jonnin)
Pushing Back Class Objects to a Vector
Here, in the code. While I'm pushing back that obj2 to vector, is it creating another class object? Because my settings are not affecting this vector element. H...
[11 replies] Last: You normally don't pass a std::unique_ptr to a function unless it dea... (by George P)
Call to Overloaded Function is Ambiguous?
Specifically on line 9. //John 3 #include "MathVector.h" #include <iostream> int main() { MathVector<double> mVec(20); MathVector<double> fVec...
[2 replies] Last: The code you posted seems to give: In function 'int main()': 132:27:... (by keskiverto)
How to select number format when writing to file
I'm modifying someone else's longer code for work, and I'm very new to C++. I have this section working, but I get only a single digit integer in the .txt file...
[8 replies] Last: I can print it to the terminal screen this way: printf("UO_Slope %e\... (by thmm)
what does this small line of code mean?
I don't think you can make a string stream == to something, so I'm wondering what function, this line of code was supposed to have? ss = (std::stringstream{...
[2 replies] Last: The "long" from of the very same code would be: std::stringstream tem... (by JLBorges)
Coin Flip Script
Hello I'm new to c++. I was wondering if someone here could do me a favor potentially. I'm somewhat familiar with Python and Scratch. I was wondering if so...
[14 replies] Last: If you throw a coin 10 million times the probability of getting exact... (by lastchance)
by jNc
get columns quantity for each row of array
Greetings! I have some data included in array with 100 rows and 100 columns. i need to roll through all of rows and columns, but i dont know actual columns...
[16 replies] Last: You could just have a regular 2D array with a maximal number of availa... (by Duthomhas)
May 2022 Pages: 1234... 6
  Archived months: [apr2022] [jun2022]

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