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

Convert Between 16 bit Scaled PCM Data to Floating Point PCM Data
 
I cannot convert between 16 bit Scaled PCM Data and Floating Point PCM Data in C++. I think I must be close because the output audio somewhat resembles what I e...
[5 replies] Last: New code works :). Thanks for you help and for the C++ primer. (by Manannan)
Strings concatenation
 
Hi guys, I'm new to c++ programming and I need to fulfill a vector of n strings with strings which are named in a similar way. Suppose that my strings are: fi...
[2 replies] Last: The only input you need is the number of files. Once you have that you... (by thmm)
by zongul
Access violating reading location
 
I have this code old_evhndl = *(FARPROC*)(obj->old_eventhandler()); return CallWindowProc(old_evhndl, hwnd, msg, (WPARAM)wParam, (LPARAM)lParam); The ex...
[7 replies] Last: I don't think mixing of 64 and 32 bit. It will created mess. (by matt112)
How to have multiple template parameters?
 
So I have this template: template<> int exampleClass<int>::display() { return variable; } But how can I have multiple parameters? Something lik...
[8 replies] Last: You know, you could just use the example I gave you in your last post:... (by TheToaster)
Where to namespaces and functions go?
 
So I know that classes can go in a separate .cpp and .h file. But where do I put functions or namespaces? Do they also follow the same a classes? So the declara...
[2 replies] Last: functions are always by design visible to any TU so namespace is need... (by marhuum)
by Dee5
Snake game
 
Hello guys im currently making a snake game. If you have any suggestions improvements. #include <iostream> #include <conio.h> using namespace std; bool ga...
[7 replies] Last: This isn't an English 101 essay. You don't need to type your code in 1... (by TheToaster)
Double array
 
Good afternoon I am new in c++. I am trying to write a code that uses an array of 2 exponent 32, A small example is the code below. #include <iostream> ...
[3 replies] Last: You can send me an email if you have an answer I'll give you an answ... (by George P)
what is execution time / speed of cmath library functions? (1,2)
 
cmath has several functions such as sqrt(), cbrt(), sin(), cos(), exp, log, log10 etc I want to know the executio time of these functions?
[21 replies] Last: Can anyone tell me in how many nanoseconds these functions will be ex... (by dhayden)
How to convert string into string?
 
So I have a template class which takes a value, and assuming that the value is a number, then it will turn it to a string, and count it's length. template...
[2 replies] Last: Please don't double post. (by TheToaster)
Where do I include header files?
 
So I have a .cpp file: #include <algorithm> class ExampleClass { public: ExampleClass(); }; And a .h file: #pragma once #include <...
[7 replies] Last: what does a class have to do with it? I'm highlighting a specific ca... (by MikeyBoy)
txt file to array, then output the txt file, then calculate the mean
 
Can anyone help please? Read the following number from Input.txt : 1 2 3 4 5 6 7 8 9 10 and keep it as array. Then display the array to external file called Ou...
[13 replies] Last: I actually agree with fewdiefie. Dropping code like this on a beginner... (by dhayden)
Differences on local/global vector/c style array
 
Hi. While I was solving some problems, which I couldn't pass for the time limitations, I've found out that only difference btw others and mine was that Mi...
[1 reply] : a 2-d array is one block of memory, so it will have fewer cache misses... (by jonnin)
by ravss2
Factory Design Pattern Example - Review
 
Hi , I have written the below program to demonstrate factory design pattern out of my understanding from the study. my Doubt is almost all the examples on in...
[3 replies] Last: A factory could also be a class if it needs resources. Imagine a facto... (by thmm)
How to include partial string?
 
So let's say that I have a string: string name = "Dynamic_Squid" How do I separate that string into two parts? "Dynamic" and "Squid" So in this case...
[6 replies] Last: @mbozzi Very elegant solution. I totally forgot that you can iterate o... (by TheToaster)
For Loop, confused
 
The request is "Write a C++ program that allows a user to enter a start value and end value (where the start value is smaller than the end value) and print all ...
[2 replies] Last: int main() { int start{}, end{}; std::cout << "Enter a start... (by TheToaster)
program to read in various types of test questions
 
Assignment instructions: Write a C++ program to read in various types of test questions (multiple choice and True/False) from a test bank (text file), and load ...
[5 replies] Last: load the questions into an array of questions. You need a class for ... (by dhayden)
help on dealing with simplifying
 
I need help with simplifying this code I wrote for a project. I want to be able to pull from it the save throw values and use them when I do rolls, however I do...
[6 replies] Last: Thank you guys I have been trying to get it to work for our overall pr... (by icecody12)
I need help understand this
 
a 3 GHz CPU .... whenever it fetches some data from the fastest cache, it is just one CPU cycle, all of a sudden, it needs a piece of data that is not in any...
[2 replies] Last: why does the CPU have to wait 36 cycles exactly It's just math. At... (by dhayden)
by Slee p
Why can't I declare "queue" for my class "linkedQueueType" in the main file
 
I am getting error in my main file: linkedQueueType<char> queue; undefined reference to `linkedQueueType<char>::linkedQueueType()' Why can't I decl...
[4 replies] Last: Templates aren't real code. The types are missing! They're just a temp... (by dutch)
Thread & Task, how are they identified?
 
Dear C++ experts, I often use TBB (or TPL in Windows) library to realize concurrent shared-memory parallel programming. I to some extent understand that t...
[no replies]
April 2020 Pages: 12345... 10
  Archived months: [mar2020] [may2020]

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