General C++ Programming - January 2020 (Page 3)

by mbozzi
What is the etymology of the keyword "virtual"?
 
In D&E, Stroustrup mentions the name "virtual" is borrowed from Simula, but doesn't go into more detail. How does the word "virtual" connect to dynamic dispatc...
[5 replies] Last: The lens may make the person appear upside down and very close, but i... (by againtry)
studying variadic fails
 
amid studying variadic, I fail to understand why this can't work template <class T> struct Accumulate { T s=0; Accumulate(){return;} template <class H, ...
[3 replies] Last: There's a huge risk to me of this being called "fatuous", but hey-ho,... (by againtry)
C++ at the end of 2019
 
Let’s reflect on how C++ changed during 2019! What were some significant events, how the Standard progressed, how tools changed and many more. Let’s have...
[no replies]
Last digit of factorial (TLE)
 
I just made a program to calculate the last digit of the factorial of an int: #include <iostream> int main() { int casos; std::cin>>casos; ...
[10 replies] Last: I guess that it's happening near powers of 10. Then the factorial is e... (by lastchance)
Ascending numbers
 
I want to make a program which should read a number n, which describes, how much numbers are goig to be read by the computer. Those n numbers have to be read i...
[1 reply] : #include <iostream> int main() { int n; std::cin >> n; ... (by dutch)
by Norej
error check is not working properly
 
okay so i have an input file and it is filled with data like so 2 200708211245 F70.5 200707210821 C19.97 I need to error check so when a negative Celc...
[1 reply] : ignore the function prototypes at beginning (by Norej)
c string not printing
 
hello, I was wondering why my c string from my array was not printing? code: #include <iostream> #include <iomanip> #include <string> using namespace std; ...
[3 replies] Last: tttt (by closed account 1bfSwA7f)
need help creating hollow triangle using for loops
 
for a school project i have to try to make a hollow triangle whose size is based on the user's input. so far i have a good portion of it down but for some reaso...
[4 replies] Last: Using your editor and a fixed-width font, create a file containing a c... (by dhayden)
Understand of "quasi" external sort
 
How can I sort these 120 integers with only 20 integers at a time by using a "quasi" external sort? I don't understand how to code this. CODE/DIRECTIONS: So...
[9 replies] Last: Ok, that's helpful. Thanks for the information. (by mlanuri10)
Call of overloaded constructor is ambiguous
 
When I try to instantiate objects of class Foo in main() of foo.cpp, I keep getting errors about how the call to the overloaded constructor is ambiguous. The co...
[12 replies] Last: @Enoizat- I didn't think about "const". That qualifier would definitel... (by vaderboi)
Copying closure of lamda expression
 
Hello, If you think this is a beginners question feel free to beat me for not using the correct forum :) Consider the following code: #include <iostream> #i...
[11 replies] Last: OK. Thank you who responded. I was thinking, a lambda is a function ... (by NorbertMueller)
3 number Random generator
 
Hello!! I’m currently struggling on my program with changing the function of getNumbers() . What I need my program to do is generate 3 random numbers ranging...
[9 replies] Last: #include <iostream> #include <random> #include <ctime> using namespac... (by lastchance)
Finding a lexicographically minimum permutation
 
I want to make a program that finds me the lexicographically minimum (basically where all of the numbers are not dupilcates and are integers above 0, and you wa...
[16 replies] Last: Yeah, I had a sh!t-load of memory problems which I've solved but not p... (by againtry)
by Norej
create a human readable output file with char arrays
 
The program must be able to work for an input file that contains following information: # of temperature readings timestamp temperature [# of temperature ...
[4 replies] Last: It's now up to you to convert what's in the buffer each time to format... (by againtry)
Solved Sudoku Puzzle (Need help)
 
Hey guys I need some help identifying the error in my program, as I'm using nested loops to print out a 2-D array of a solved Sudoku puzzle. I was trying to fig...
[3 replies] Last: Line 13. What makes arr so special that it doesn't need to be checke... (by dhayden)
Broker Chain
 
Hi, I'm reading Design Patterns in Modern C++ by Dmitri Nesteruk (I'm not sure I can recommend it, but I bought it, so I should read it. Its chock full of er...
[1 reply] : I might have seen something of this nature with a message filter; the ... (by Repeater)
Using execution file vs debug
 
The git hub for my project is: https://github.com/Doraonroids/Pucker I'm using visual studio 2019. When I debug the code using VS it runs just fine. When I g...
[2 replies] Last: ^^ The above is a common issue as VS sets up paths for you when you r... (by jonnin)
It is not detecting any syntax errors but it just ends instantly.
 
//******************************************** //File:wk1_change.cpp // //Summary: a program that whan given an amount of change will tell you what coins wil...
[5 replies] Last: Type: System("pause") or cin.get() This worked for me, so I hop... (by b p t)
by Norej
project dealing with char arrays
 
YYYYMMDDHHMM (e.g. 200708201425) This should be converted to: 08/20/2007 1425 i need to convert the above char array (200708201425) to an actual time s...
[8 replies] Last: For a one-off timestamp I wouldn't need base, and I could initialise b... (by lastchance)
by bibo
Segmentation fault:11
 
vector<int> solve(vector<int> arr, vector<int> queries) { vector<int> res; int n = arr.size(); int q = queries.size(); int col = log(n) / log(2...
[5 replies] Last: Thanks it worked :) Thanks for using code tags. :) And note that dh... (by dutch)
January 2020 Pages: 12345... 9
  Archived months: [dec2019] [feb2020]

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