Beginners - July 2022 (Page 2)

My object was not declared in this scope, even after assigning it inside a switch statement
Hello, I am making a class for a character with some attributes. I also made an inherited class. I made a system for choosing between different objects made fro...
Jul 26, 2022 at 4:18pm
[12 replies] Last: :) :) Ok. I didn't pay sufficient attention to L43. It was at the bott... (by seeplus)
by K9WG
Large Text File
Greetings I am wanting to access and navigate a large text file. The file is about 40,000 lines with up to 200 characters per line. I can read and write to the...
Jul 25, 2022 at 5:00pm
[17 replies] Last: OK - After a lot of experimenting I have decided on deque to handle ... (by K9WG)
What's the time complexity of .size() when implementation maintains count when items are inserted/deleted?
I was tempted to say it's linear to the number of .insert() and .delete() calls but this isn't correct because it doesn't take any longer to compute and return ...
Jul 24, 2022 at 3:59am
[4 replies] Last: [quote=Peter87]The time complexity of calling size() is constant ( O(1... (by ElusiveTau)
by a456df
How do you find a position of an element in a queue?
I'm not sure I'm using correct terminology. How would I create a queue for a 2d array that finds the position of a specific element and increases the value o...
Jul 23, 2022 at 12:18pm
[6 replies] Last: Thank you all! I'm testing several suggestions. I appreciate your help... (by a456df)
Bug at line 11 and 24
//Weird Bug (Single letter wont trigger bug BUT when you put multiple letter Bugs at l-24) this is line 11 #include <iostream> using namespace std; ...
Jul 23, 2022 at 8:52am
[2 replies] Last: thanks i forgot about that (by gabzz29)
Need help with C++ tuple values please
I am writing Arm C++ embedded program using C++ map STL, with two keys pair and three values tuple. And the function is crashing because the compiler do not al...
Jul 23, 2022 at 3:41am
[11 replies] Last: > this decomposition feature is available in C++17 Ignore the warnin... (by JLBorges)
How do I write this code
Write your question here. If there are 18 people in your class and you want to divide the class into programming teams of 3 members, you can compute the ...
Jul 23, 2022 at 2:08am
[13 replies] Last: #include <iostream> #include <map> #include <boost/multiprecision/cpp... (by JLBorges)
char array member is not what it is supposed to be.
Hi, I am having a bit of a problem, my code reads from a .txt file with the data: TTFTFTTTFTFTFFTTFTTF ABC54102 T FTFTFTTTFTTFTTF TF DEF56278 TTFTFTTTFTFTF...
Jul 22, 2022 at 4:35pm
[1 reply] : When posting code, please use code tags so that the code is readable! ... (by seeplus)
by Lmac
Add and Remove a student vectors
okay here my new code that boosted my grade, however I am still haveing a hard time on Add and remove the vectors of students and i have checked throughly over ...
Jul 21, 2022 at 4:03pm
[7 replies] Last: Using a struct, then possibly as C++20: #include <iostream> #includ... (by seeplus)
Variable remaining in memory after stack termination in a pointer returning function with a pointer argument
Hello all, Being new to pointers and needing practice I thought I would write a simple function to try and understand them better. This is the function I wr...
Jul 21, 2022 at 2:56pm
[9 replies] Last: Hadn't come across it before - but worth a read. :) (by seeplus)
Why does std::set provide a .find() method that takes a reference to an item to be found?
If you have the item you want to look for, what's the point of searching for it in a container? Taking a shot at answering my own question: The object i...
Jul 21, 2022 at 7:04am
[3 replies] Last: Finding out whether a value is present in a set is indeed a common ope... (by Peter87)
constructors
when creating an object with a constructor, as far as i understand, we don't name the object. so how can we reference that object later. i know two ways to cr...
Jul 19, 2022 at 9:54pm
[4 replies] Last: class is a c++ keyword that creates a TYPE. NOT an object, but a TYPE... (by jonnin)
finding index of a number
C++, How do i make choice "C" to find the index of the value entered by the user? Here are my codes. #include <iostream> using namespace std; int mai...
Jul 19, 2022 at 6:38pm
[1 reply] : There are various issues with the code. Why use a switch() and then ha... (by seeplus)
What should I put in the main function ?
This is a very complicated, I'm trying to build a main menu and a sub menu, the users choose options in the main menu, they will go to the sub menu (all the opt...
Jul 19, 2022 at 3:49pm
[8 replies] Last: Many people prefer for(;;) , because it definitely has no condition... (by kigar64551)
How to move back to the main menu ?
I'm writing a menu where the users can choose, any options will make them input a string, after that the program will ask if they want to continue or not, if th...
Jul 19, 2022 at 7:44am
[4 replies] Last: Thank you very much ! (by NormalUser1234)
access variable outside for loop/function
how do i access a variable initialized in a for loop or a function outside of it? in the code below, i can only cout name inside of the for loop. how can i g...
Jul 18, 2022 at 12:16am
[3 replies] Last: thanks a lot. that was very helpful. (by cloudEndeavor)
How to read a pbm/pgm/ppm image from a file
I am trying implement a program that read a PBM/PGM/PPM image from a file, following the description from here: https://en.wikipedia.org/wiki/Netpbm , and displ...
Jul 17, 2022 at 3:47am
[2 replies] Last: Write the following: ht tps://en.wikipedia.org/wiki/Netpbm [ b][ ... (by Duthomhas)
showing the arguments' name passed to a function
Hello, Is is possible to show the argument's name when passing them to a function in c++. For instance in python you can do this (this is a random example)...
Jul 17, 2022 at 2:57am
[3 replies] Last: While the designated initializers (which C has had for a while now and... (by Duthomhas)
Heuristic for A* algorithm
Hi I was reading into the A* algorithm. One of the key elements of the algorithm is that it uses a heuristic to approximate the distance to the target. A...
Jul 16, 2022 at 9:46pm
[1 reply] : If each node in the graph has an x and y coordinate then you could use... (by Peter87)
to calculate score for all round
i already done the scores for each round, i dont know how to calculate the scores for all round, can u help me to solve this? #include <iostream> #includ...
Jul 16, 2022 at 7:57pm
[7 replies] Last: @avocado16, just saying "it doesn't work" is too little information. ... (by deleted account xyzzy)
July 2022 Pages: 12345
  Archived months: [jun2022] [aug2022]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.