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...
May 25, 2022 at 8:21am
[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 ...
May 24, 2022 at 5:01pm
[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...
May 24, 2022 at 4:15am
[6 replies] Last: See also: http://www.cplusplus.com/reference/fstream/ofstream/open/ (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...
May 23, 2022 at 11:05pm
[7 replies] Last: I think the single most important thing you can do is comment your co... (by deleted account xyzzy)
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...
May 23, 2022 at 4:22pm
[9 replies] Last: seeplus, I suspect the OP has moved on to another topic, this time muc... (by deleted account xyzzy)
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...
May 22, 2022 at 9:40pm
[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 ...
May 22, 2022 at 6:09pm
[8 replies] Last: There is an alternate download site for the current Code::Blocks versi... (by deleted account xyzzy)
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...
May 22, 2022 at 1:58pm
[6 replies] Last: There are 3 ways to iterate through a regular array: #include <iostre... (by deleted account xyzzy)
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...
May 22, 2022 at 4:08am
[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....
May 21, 2022 at 6:19am
[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...
May 21, 2022 at 2:06am
[11 replies] Last: I tend to avoid youtube since it is a classroom experience with someon... (by deleted account xyzzy)
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> ...
May 20, 2022 at 4:52pm
[11 replies] Last: @seeplus, I tried using "Unicode" (the default) and "Multi--byte" enco... (by deleted account xyzzy)
STL stack: Does calling stack.pop() invalidate stack.top() object?
This is from a Leetcode binary tree traversal exercise. /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left;...
May 18, 2022 at 9:05pm
[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...
May 18, 2022 at 7:29pm
[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...
May 18, 2022 at 2:46pm
[11 replies] Last: You normally don't pass a std::unique_ptr to a function unless it dea... (by deleted account xyzzy)
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...
May 17, 2022 at 7:38pm
[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...
May 17, 2022 at 5:48pm
[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{...
May 17, 2022 at 8:45am
[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...
May 17, 2022 at 8:37am
[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...
May 16, 2022 at 11:16pm
[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.
Registered users can post in this forum.