General C++ Programming - April 2022 (Page 2)

by t im
quertion about std::sort cmp function
When I define a vector<int> contains one hundred 0s and sort with the code below, an exception "invalid comparator" throws. vector<int> v(100, 0); sort(v.begi...
[2 replies] Last: Thanks a lot. Your answer really benefits me. (by t im)
by Cplusc
Installing Trilinos on windows
I am trying to include Trilinos in my project and I understood prior to that I need clapack library. I tried to install clapack and I was successful to build AL...
[3 replies] Last: did the compiled lapack work at least? one at a time... first you ha... (by jonnin)
by frek
Compile time evaluation and performance
Hi all, In this piece of code: #include <iostream> constexpr double nth(double x, int n) // assume 0<=n { double res = 1; int i = 0; while (i<n) {...
[9 replies] Last: What is the benefit of constexpr? It provides a way to reliably ... (by mbozzi)
by linaya
编写程序,计算下列公式中的s s=1*2-2*3+3*4-4*5+...+(-1)^(n-1)*n*(n+1) 这是自己做的,实在不会了 #include<stdio.h> #include<math.h> i...
[2 replies] Last: Google translate: Title: The novice has been thinking about it for a ... (by AbstractionAnon)
char array manipulation
Can anyone tell me what is wrong in this code and how to fix it? here bytearray gets destroyed as it reached end of the loop, i guess. #include <bytearray>...
[11 replies] Last: Thanks all for your valuable inputs here. Closing this thread now. (by leo2008)
AlphaBlend() can make 1 color transparent too?
using the AlphaBlend() can make 1 color transparent too? what i mean is make a color transparent(like TransparentBlt()) and using the AlphaBlend())... Transpa...
[4 replies] Last: after several tests, i notice these: 1 - zero will be Alpha Transparen... (by Cambalinho)
7 segment displays (1,2)
My program is supposed to prompt the program user to enter text to be displayed on our 7-segment display. The text string should accommodate up to 64 characters...
[20 replies] Last: everything works perfectly, thanks for your help! (by PopSmoke)
by tonic
c++ Client/server
Hello dear cpp members I had a questions, I used to work with c# (background workers) async/await to finish different tasks. now im coding some c++ clients , ...
[1 reply] : you probably need to thread at least some of that. screen share is in... (by jonnin)
expected primary-expression before ‘]’ token myArray <int> obj(arg1[], size); Confused as to why this is happening
The code is supposed to print out the highest value in an array The error is also occurring in my constructor for list = arg #include <iostream> using nam...
[4 replies] Last: Maybe something like: #include <iostream> #include <algorithm> te... (by seeplus)
Unknown debugging errors
I've been working on this project for a class for several weeks now with help from my teacher and we worked on this version together so it has all the required ...
[8 replies] Last: Really weird echoing now that the OP has decided to cut and run. At t... (by George P)
Comparing all characters within two strings of different length (1,2)
let's say I have two strings: str1: aaabcabaaaba str2: bca I would like to slide str2 over str1 to figure out if str2 matches str1. So, here for examp...
[20 replies] Last: PS. I submit exhibit 1 - the new, 'improved' camel... (by seeplus)
by frek
Genomic Range Query
A DNA sequence can be represented as a string consisting of the letters A, C, G and T, which correspond to the types of successive nucleotides in the sequence....
[14 replies] Last: Assessing what was already written using paper and pen it turned out t... (by frek)
by ManaG
int was not declared in another function
#include <iostream> #include <fstream> using namespace std; struct stac { int r, g, b; int x, y; int dx, dy; }; struct galinis //galine...
[3 replies] Last: Thank you, also I will use them next time, I haven't thought about it ... (by ManaG)
by Cplusc
Calling a constructor in a loop
I have a constructor which take 3 arguments including 3 vector of vector of type double and one vector of pointers double. Let's say the loop iterate 4 times, i...
[14 replies] Last: I fixed it. The problem was an & missing somewhere in the code. Thank ... (by Cplusc)
by mnm71
How to find peak in c++
In this code, I calculate the number of peaks and check the result with the Findpeaks Matlab function []...
[5 replies] Last: Or with a state machine: #include <iostream> #include <vector> using... (by lastchance)
using StretchDIBits() can i draw transparent and semitransparent?
using StretchDIBits() function, can i draw it without a color(backcolor transparent) and semi-transparent(opacy)? void New(unsigned int SizeWidth, unsigned int...
[11 replies] Last: theres so many code.. but i choose the used class Bitmap functions: v... (by Cambalinho)
Buenas a todos, estoy necesitando hacer un ejecutable win32 donde pueda pedir un numero de puerto para enviar un numero por puerto serie, lo unico que necesito ...
[3 replies] Last: it is important to decide if a number is in binary or text form. If in... (by jonnin)
formula to get nearest number (1,2)
Hey everyone, I'm creating a midi program to alter incoming midi and putting out the altered midi, I do a bunch of stuff with it (one note chords etc) and ev...
[20 replies] Last: off course that was it, tx! (by wimvandenborre)
Getting proper calculations to work?
I am trying to have my program calculate the min, max, total, average, etc, of Hawks. But it keeps giving strange results like 0 and inf. What am I doing wrong?...
[3 replies] Last: As a possible first refactor, consider: #include <iostream> #includ... (by seeplus)
Cin function wont work?
I am trying to get my cin function to work with this program, and it was working before, but now after some changes it is giving me an error for using the opera...
[7 replies] Last: I have been building up this code based on a template and help from ot... (by Blueshark1)
April 2022 Pages: 1234
  Archived months: [mar2022] [may2022]

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