General C++ Programming - June 2021 (Page 2)

Check if there is at least one sequence of three zeros in the list
 
I need to check if there is at least one sequence of three zeros in the list (array) using an array (a regular array that is completely (!) Filled with 10 eleme...
[2 replies] Last: just please help me figure it out, Use the debugger to trace throug... (by seeplus)
Aggregation relationship and pointer
 
I have some question with the pointer, how should I do if I want to add the item array into a customer? for(int i=0; i<numItem; i++) { data[cho...
[2 replies] Last: Ouh I see, thank you so much! (by saltyyyyy)
Reading from multiple txt files (i.e 100 txt files) with one ifstream
 
Hello, Any ideas of how to read from multiple txt files (i.e 100 txt files) with one ifstream? Is there a loop for that? ifstream fin("filename.txt"); ...
[15 replies] Last: I saw it. Thanks really a lot for helping me out! (by gevCplus)
object oriented programming
 
I have problem in the pointer aggregation, if we aggregate an array in a class to another class, how should we initialise them using a constructor? and also I h...
[4 replies] Last: but it works! I doubt it. It doesn't crash because you forget to inc... (by kbw)
Plz your help!
 
Hello, I created a program doing the following thing: Read from txt files, calculate a number called Div, set up a sorted general filename-Div list and writ...
[16 replies] Last: No worries, you can read all about it at this link: https://en.cppref... (by TheIdeasMan)
by vboro
Searching the biggest value of 'H' shaped regions in a matrix
 
Hi! I got the task where I must find the H shaped region which has the biggest sum of numbers in it. The 'H' shaped region is something like this: x x xxx x ...
[8 replies] Last: there is probably some slick way to do it making use of overlapping, b... (by jonnin)
Important Pair question #2
 
Hello again, I am having problem with the following. I am trying to read data with commas from a txt file into pairs, and store the pairs into a set of pairs i...
[4 replies] Last: Possibly something like: #include <fstream> #include <iostream> #in... (by seeplus)
object oriented programming
 
hello everyone, I am facing a problem in displaying the output here is the code #include <iostream> #include <iomanip> #include <string> using namespace...
[15 replies] Last: solved! thank you so much (by saltyyyyy)
What does a colon : do after a class definition?
 
I'm trying to debug some code and I see class SomeClassHere : public AnotherClassHere { public: SomeClassMethod(); virtual ~SomeClassMethod(...
[2 replies] Last: Ok thats interesting. Thanks. (by sonofptolemy)
STL Pair questions
 
Hello guys, I have the three following questions: 1)Suppose we have the following set of pairs (set<pair<int,int>> set_name) { (1,10) (2,20) (3,30) (4,...
[3 replies] Last: Guys thank you very much for your replies! (by gevCplus)
Convention for which source file to put your includes
 
This is a question about convention I think since it seems it does not matter where you put your include declaration (your header file or your c source file?) ...
[8 replies] Last: So then @jonnin would it look odd to have virtually no #includes in yo... (by jonnin)
The finished code needs an explanation
 
Hello everyone, I have a code that matches the following assignment: 1) Count the number of occurrences of the prog message line in two ways: using an iterat...
[5 replies] Last: As a first refactor, possibly consider: #include <iostream> #incl... (by seeplus)
Line drawing function fails strangely...
 
Hello. I followed a tutorial that explained how to draw a line in C++, my version of the result code is this: #include <iostream> #include <string void print...
[8 replies] Last: G++ 9.2.0. Ah, it seems that after a brief project refresh it was reso... (by SirEnder125)
Error writing objects of a class to file
 
Hello everybody. I am learning C ++ programming by myself, watching YouTube videos about C ++ programming and reading some free books that I download from th...
[9 replies] Last: Thanks everyone for your help. I changed the program from std :: strin... (by javier55)
by vboro
Problem with char** typed function
 
Hi! I got the task where I must get first and middle name of authors from a .txt file and sort them into a char array, one column for first and the other for m...
[3 replies] Last: You're welcome - glad I could help! It's an easy mistake to make. In... (by MikeyBoy)
Unable to read object form file
 
Unable to read object from file when using std::string or char * but i really have to use any of them, is there any way that it will works? #include <iostre...
[7 replies] Last: Thanks you all for answers (by lablnet)
code tags not working
 
Hi, I'm trying to use code tags when posting but it doesn't work for me. I read the instructions how to use the code tags, but I don't see why it doesn't wor...
[1 reply] : The forum is buggy and the format buttons and preview do not work when... (by Ganado)
Confusion about line drawing code - "Strange" use of floating-point type.
 
Hello. I was following a tutorial about how to draw a line https://joshbeam.com/articles/simple_line_drawing/ . I want to understand it as best I can, but I ha...
[2 replies] Last: Alright. So, for instance, x1 + ((y - y1) * slope) will have a diffe... (by SirEnder125)
Please assist or show me how to finish one of the .cpp files in a Banking program with header files (1,2)
 
Problem Description: This program covers the above concepts with an example that is dealing with bank transactions. Generally a person can have an account like ...
[28 replies] Last: Re-read this comment from 10 days ago, especially the paragraph 3rd fr... (by dhayden)
The promise of GUI on all platforms
 
In the early days of my programming hobby, I wrote for DOS and if I wanted a button, I had to draw it, watch it, react to it, etc. Fast forward to the coming o...
[4 replies] Last: But no-one starts new gui projects using WIN32 API (or unlikely MFC) t... (by jonnin)
June 2021 Pages: 12345
  Archived months: [may2021] [jul2021]

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