General C++ Programming - March 2021 (Page 5)

2D Arrays
 
Hi people I just started doing c++ and Im instructed to do this without any background hope you guys help me thanks. This is the Instruction: a 10 x 15 array ...
[2 replies] Last: Why printf() and scanf() - these are c functions. Have you come from a... (by seeplus)
by ngb123
handle reference of struct instance inside class
 
Hi! I'm having some troubles to handle different struct instances inside a class. In summary, the essential code looks like this: enum class StepperIterator ...
[2 replies] Last: Now the problem is that my StepperHandle instances x,y,z are not hand... (by coder777)
by chxx
Can you help me with this c++ structure?
 
I'm trying to write a structure where i ask to the user how much students he wants to register. Then it ask for the name, code, group and score of the students,...
[6 replies] Last: Seeplus, that's a good version, thanks for writing it. (by chxx)
Confused about returning by reference.
 
How can I safely return a reference to an object?
[6 replies] Last: Okay. Thanks a lot! :D (by SirEnder125)
Replacing letters
 
So i want to replace letters to adaptate my letter language, i made a program but when it replaces letters it replaces letters multiple times for example : whe...
[8 replies] Last: if you are using char, and there is more to it than 10 or so letters, ... (by jonnin)
by JRManx
Encryption Program Issue
 
I am having issues with a while loop in an encryption program. When I try to execute this piece of code: char ch = '\0'; // individual character in text str...
[19 replies] Last: @jonnin, Thanks for the warning! I am careful, because I know what ca... (by JRManx)
Work with array
 
There is a code: statistics.h contains two function declarations: meanTime - Returns the average time over an array (double). stdTime - Returns the res...
[4 replies] Last: Your sum won't fit in an int for those sort of values of n. use unsi... (by lastchance)
Use of opencv waitkey() with C++
 
I'm trying to display the webcam feed with a timer but it doesn't render smoothly. Here is the code : int timer = 10; VideoCapture cap(0); Mat img;...
[1 reply] : rtfm https://docs.opencv.org/master/d7/dfc/group__highgui.html#ga56285... (by ne555)
proxy Undefined type error
 
Hello everyone, I have been working on this for two days. I've been Googling a lot and couldn't come up with an solution. Any help would be appreciated. I...
[3 replies] Last: You're welcome! Glad I could help. (by MikeyBoy)
Strange compilation error
 
Hi, In the example below, I use 2 "dummy" classes (LoKey and HiKey) to choose between 2 constructors in MyKey class. This works very fine except in the last tes...
[4 replies] Last: C++11 did add brace initialization syntax to offer a way around the ve... (by keskiverto)
Cycle for (1,2)
 
There is a code. It counts the time of function foo() with the help of measureTime(). It works but sum in foo() is counting only 1 times. So I have 3025 on cons...
[37 replies] Last: Sum is 1 It took 0.0005066 seconds Sum is 3 Sum is 9 It took 0.003... (by onetwo123)
by Setat
Shift Rotate a binary number.
 
Hi, I need to XOR two binary numbers bitwisely. (ex: 0010 xor 0111) The second number should be right-shift-rotate by two bits first. How I can shift-Rorate ...
[8 replies] Last: I came back to this one late to look at it from a less general side...... (by jonnin)
Dynamic allocation copy constructor
 
Hi, I am learning Class and I want to write a code that insert value into an array that have been allocated dynamically. I want my program to increase memory al...
[5 replies] Last: Consider: #include <iostream> #include <algorithm> class Data { pr... (by seeplus)
Any Help?
 
Another edit and run poster. @seeplus, if you delete your post, I can delete this and then the whole sorry mess will vanish.
[1 reply] : First design the program, then code the program from the design. First... (by seeplus)
by Ticbow
Text adventure rooms - Voids or Classes?
 
Hi, I'm working on a little text adventure project in C++ and I'm not quite sure how I'll do the rooms in the game. I was considering using a room class and mak...
[6 replies] Last: Wow! I didn't expect this many responses! This was all really helpful,... (by Ticbow)
Frequency
 
This program will analyze a text file given by the user and report the frequency of letters within the file. The program is not case-sensitive, so all alphabet...
[7 replies] Last: Ok, crashing isn't the right word, but I think (hope) he got my meanin... (by JRManx)
Looping Error
 
Hey there, I'm having some trouble with a function that is supposed to prompt a user to enter the name of a customer they would like to edit. I have the custome...
[4 replies] Last: Ahhhhhh, the noobery. Thanks a ton. (by coff33Cup)
explicit conversion needed using cast operators?
 
(This is a continuation of a previous thread: http://www.cplusplus.com/forum/general/275419/) class foo { public: ... operator void*() const { ...
[3 replies] Last: Okay. Sorry guys. I don't know why this didn't compile before. Actuall... (by daytooner)
Attempt to output "autocorrect" words (using .txt files)
 
Trying to finalize two function's codes I think my void Dictionary is fine, but void Alternate isn't working properly (it outputs nothing (None) at the end of e...
[2 replies] Last: Hello juicypwner, In addition to what coder777 has mentioned these ... (by Handy Andy)
Operating Overloading
 
Hello, I was exploring C++ for the first time and trying to understand few concepts. I came across this topic: Operator Overloading and understood the basics...
[4 replies] Last: @seeplus: the std::cout on line 16 ... os ? Whoops....... It should... (by seeplus)
March 2021 Pages: 1... 34567
  Archived months: [feb2021] [apr2021]

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