Beginners - January 2022 (Page 2)

Need advice - Kadane's algorithm vs Recursion method
 
My Question - how should I learn more effectively? 1) just learn the most effective/simpler way of solving a code challenge? or 2) study all the various way...
[6 replies] Last: thanks Jonin, well written and your explanation is helping me progress... (by memepapa)
error: no type named 'cout' in namespace 'std'
 
I must have introduced some error that I can't pinpoint been writing using std::cout; instead of using namespace; but somehow i can't compile this and I k...
[11 replies] Last: thanks for expanding on this discussion, I'm learning from your exchan... (by memepapa)
by limwn
How to search in struct in c?
 
Hi, I learned struct recently, however, I don't know how to search something in struct. Here's my attempt. I actually want to search the performer's name, and...
[2 replies] Last: exact string searching is painful to the user. the caps/lower letters... (by jonnin)
Find element in priority queue
 
I was just wondering...How do you find an element in a priority queue if you only know its value with a time complexity of O(1)? Not wanting to bother anyone......
[4 replies] Last: @seeplus It's just a problem on our online judge which I wanted to sol... (by Highground7490)
How to combine/sort text from an email and a .txt doc
 
Hello. For part of my job, I receive emails with rows of numbers (PM's) that look like this: 35287385 35287387 35287389 Usually there's ...
[11 replies] Last: Here's my best progress so far #include <iostream> //#include <strin... (by the other jorge)
by alexas
Advice for data container / structure
 
Hello I have some sort of branched data structure, see the image: https://ibb.co/TPMMfYb Basically every branch is the std::vector with set of coordinates ...
[14 replies] Last: @kbw: without further information, I think your first post is the best... (by newbieg)
Split 3D into 1D vector
 
If I have a 3D cube of a given dimension, say 50x50x50, and I want to split it into smaller cubes of 5x5x5, i.e. splitting it by 10 at each edge, how can I appr...
[2 replies] Last: Thank you very much (by ragnarokas)
Is this the correct way to get an "user" directory
 
I'm still new at VC++ and wondering if this is the best way to get the current user directory in windows? char* userpath = nullptr; size_t sz = 0; std:...
[6 replies] Last: Have a look at SHGetKnownFolder https://docs.microsoft.com/en-us/windo... (by seeplus)
How to clear the input stream when given two inputs
 
When I enter 2 letters (such as b c) as the coordinates to check if the program outputs an error message, for some reason, it outputs two error messages instead...
[1 reply] : #include <iostream> #include <utility> #include <string> #include <re... (by JLBorges)
by Hcarr2
assigning variables
 
"If the input is: 611408 Then, Leo would have eaten 6 pounds of meat and 11 bones. Una would have eaten 4 pounds of meat and 8 bones." How do I make a progr...
[5 replies] Last: #include <iostream> #include <string> using namespace std; int main(... (by lastchance)
unordered_set<int> s( argument1, argument2 );
 
I'm trying to find more documentation related to this code unordered_set<int> s(nums.begin(),nums.end()); but the books i'v been studying, such as Progra...
[2 replies] Last: s will contain the unique elements added from nums. If the size of s i... (by seeplus)
File write problem
 
I am not using any "/n" or "endl" then also my file stores the data every time in a newline. I don't know why. Can anyone explain! #include"header...
[2 replies] Last: THANKYOU @salem c (by pilot1909)
How to convert this txt file to an table output
 
I have a "New.txt" file with this data in it : userchoice_for_vehicle,vehicle_No,manfacture,in_time 1,1122,BMW,Mon Jan 17 11:50:00 2022 2,2233,Honda,Mon Jan 1...
[9 replies] Last: As an extension, this will read the file, display the data and then re... (by seeplus)
Execute section of code only once
 
I am attaching a toggle switch to an servo motor. I want the servo to rotate from 0 to 90 and back to 0 only once when the toggle is switched on. Right now the ...
[11 replies] Last: A toggle switch turns power on or off and does not automatically retur... (by againtry)
when use object replace smart pointer as member in class
 
such as the below code, EmbedderEngine has some members, what question I asked is when using a raw object as a member and when using a smart pointer as a member...
[1 reply] : > using a raw object as a member and when using a smart pointer as a m... (by JLBorges)
Time display format
 
I want my time to print only in hh:mm:ss format ... I don't want date and year #include<iostream> #include <ctime> using namespace std; int main() { ...
[4 replies] Last: The format returned from ctime() is fixed (www mmm dd hh:mm:ss yyyy). ... (by seeplus)
C++ 20 full features
 
Dear experts, I will like to inquire about anyone having any idea when will the full features of C++ 20 be implemented in GCC and/or G++. I am using the date ...
[16 replies] Last: There are more BB Code tags usable here, not just code tags. See 2nd ... (by George P)
Can't stop my character to fly around when jumping
 
Hello ! I'm creating a game as a project for my Bachelor's Degree using the SDL lib and a simple implementation of an ECS I'm also making. The game will be a s...
[9 replies] Last: Simply, there are 3 basic equations: v = u + at s = ut + (1/2)a(t^2) ... (by seeplus)
How to use a non-const int to assign array size?
 
This is purely a conceptual question. I am aware I can use dynamic containers like std::vector, but I want to know if this is possible. Compiler is c++14. I...
[10 replies] Last: The reason I want to stick to statically sized arrays is because they... (by mbozzi)
main within class?
 
Was looking for supplementary video tutorials to understand recursion and this is one that I couldn't understand 1) void main() within a class? how does tha...
[5 replies] Last: Learn C++ on "Recursion": https://www.learncpp.com/cpp-tutorial/recur... (by George P)
January 2022 Pages: 1234... 6
  Archived months: [dec2021] [feb2022]

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