Beginners - June 2022 (Page 4)

Is there anyways to make this less complex?
 
I have to delete a node in Binary Search Tree. But somehow my testcase take too much space to run. Can I make it less complex? #include <iostream> struct...
[3 replies] Last: Deleting a node in a binary search tree is not trivial. There are seve... (by seeplus)
Error: MATLAB vs C++ output
 
I am converting a MATLAB code to a C++ and running into small differences b/w my two codes. For some reason in the C++ code, each term in dVGL is correct whe...
[7 replies] Last: @jonnin Okay, I was able to fix the main "out of band issue" and get ... (by JamieAl)
Character/ASCII - Question
 
I am fairly new to C++ and still learning. I understand the first code is casting a char into an interger. But I don’t understand the second one? Is it me...
[5 replies] Last: [quote=copypasta]I am fairly new to C++ and still learning. There is ... (by George PlusPlus)
Switch statement??
 
Hi guys, I'm putting a switch statement in a loop, for example with 3 cases as below. How do I make sure that in order to proceed with the 3rd case, 1st and 2nd...
[2 replies] Last: Don't use a switch statement. You expect to input one number, then ano... (by dhayden)
how to prevent array of ints from edits
 
Have array of ints, dynamically filled... Need to use the data from array, but prevent it from writing. Can't use const. Kindly advise
[9 replies] Last: Im 100% sure nothing amends the original contents, it's magic number ... (by dhayden)
Scientific Computing - Debugging Tools (1,2)
 
Greetings! As a PhD student, I usually write programs from the domains of physical simulations, numerical algorithms or data science methods. Examples of code ...
[20 replies] Last: I usually write programs from the domains of physical simulations, n... (by seeplus)
Student's Basic Information and Grades
 
Create a program that would let the user manage students' basic information and grades on a number of subjects dynamically. The program should accept the fo...
[1 reply] : L9 & 10 - you need to specify the size of the arrays. In C++ the size ... (by seeplus)
by jNc
Compile two cpp files with QT Creator
 
Hi, folks! Need to compile: #ifndef TEST_H #define TEST_H int a = 0; void simplePrint (); #endif // TEST_H #include <iostream> #include <iom...
[13 replies] Last: I need to use data set with Base class with derived classes.. Great,... (by mbozzi)
Pong game (SFML) (1,2)
 
I picked up this book on SFML, "Beginning C++ Game Programming" & I am learning a lot. I am able to rewrite the code like a good little parrot, but this one sam...
[34 replies] Last: Thanks George, I will have to hit the Win32 API eventually as well and... (by CodeChaser)
Ant simulator
 
How do I solve my problem where my if statement doesn't follow parameters #include<iostream> #include<string> #include<vector> using namespace std; int...
[5 replies] Last: [quote=salem c]Don't try and run code until you've fixed all the issue... (by George PlusPlus)
Edmonds-Karp for Max Flow having timeout
 
Hello there :) So here's the thing: I've written a code for the Edmonds-Karp Algorithm for Max Flow in a Graph. And it is working for very small graphs, but I ...
[4 replies] Last: Oh wow, thanks. I think now I understand the stuff that went wrong wit... (by Mae4ashy)
C++ vs MATLAB syntax: Incorrect results
 
This is a pretty simple question, I am not sure what I am missing. MATLAB code: Nx = 10; Ny = 10; Lx = 2*pi; ygl = -cos(pi*(0:Ny)/Ny)'; VGL = c...
[2 replies] Last: @lastchance wow, you're right I have no idea how I couldn't see it. Th... (by JamieAl)
by ksh02
Replacing a local object causes warnings (deprecated-copy)
 
Hi C++ forum, I have an issue regarding this snippet StringSeq result = StringSeq(seq); for (Variant* var : vars) { result = var->applyTo(result, offse...
[4 replies] Last: StringSeq& StringSeq::operator=(StringSeq const& other) { data = o... (by seeplus)
2D Array
 
Hello, i want to add a function that determines whether in the component of the matrix A exists a magic square of dimension k >= 2, that is, the sums of the ele...
[1 reply] : Here's how geeksforgeeks would do it: https://www.geeksforgeeks.org/ch... (by newbieg)
Is this an appropriate use of std::optional?
 
Hi I have a container class along the following lines: template <class T> class Container { public: void addElement(int id, T t) { ...
[1 reply] : I think option one is the best choice. The interface is appealing: v... (by mbozzi)
read 2D array from file
 
Greetings! What's the current best way to read in a 2D double array from a file? The structure should be like this, I assume. void read_dataset(string dataf...
[6 replies] Last: Cheers, then I got it! (by PhysicsIsFun)
I want to make a book system
 
I'm making a book system, although I'm stuck. My goal is to let a user input another book if he/she wants to. also I want to let the user return to main menu ...
[3 replies] Last: OK, let's not get into dynamic memory just yet (it will be desirable l... (by newbieg)
how do i convert a unicode number into a char
 
I want to convert a Unicode number into a char, like how you can with an ASCII number, for example, I want to turn Unicode 931 -> Σ; is there a function in th...
[2 replies] Last: Each character that exists in the Unicode standard is unambiguously id... (by kigar64551)
Spaces / Columns
 
Hey so I have a question regarding something about spaces. ok so lets say the program uses input from the user, it then auto creates like a card. Now everythin...
[14 replies] Last: C++20 String Formatting Library: An Overview and Use with Custom Types... (by againtry)
expected a ; even though it's a function
 
I'm building a library system for my project, then as I was writing my code, I got an error about "Expected a ';' C/C++(65) [Ln 53, Col 13] I double checke...
[3 replies] Last: Oh, wait, I figured it out, Thanks Peter87 The problem was I assigned... (by grahams)
June 2022 Pages: 12345
  Archived months: [may2022] [jul2022]

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