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...
Apr 23, 2022 at 8:22am
[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...
Apr 22, 2022 at 12:57am
[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) {...
Apr 21, 2022 at 5:23am
[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...
Apr 20, 2022 at 1:41pm
[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>...
Apr 20, 2022 at 12:02pm
[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...
Apr 17, 2022 at 8:17pm
[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...
Apr 17, 2022 at 1:06am
[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 , ...
Apr 16, 2022 at 11:22pm
[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...
Apr 16, 2022 at 11:11am
[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 ...
Apr 15, 2022 at 9:40pm
[8 replies] Last: Really weird echoing now that the OP has decided to cut and run. At t... (by deleted account xyzzy)
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...
Apr 15, 2022 at 4:00pm
[20 replies] Last: PS. I submit exhibit 1 - the new, 'improved' camel... https://en.wiki... (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....
Apr 13, 2022 at 7:06am
[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...
Apr 12, 2022 at 7:25pm
[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...
Apr 11, 2022 at 3:59pm
[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 [https://www.mathworks.com/help/signal/ref/findpeaks.html]...
Apr 11, 2022 at 12:20pm
[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...
Apr 9, 2022 at 6:53pm
[11 replies] Last: theres so many code.. but i choose the used class Bitmap functions: v... (by Cambalinho)
ENVIAR DATOS POR PUERTO SERIE.
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 ...
Apr 9, 2022 at 6:44pm
[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...
Apr 9, 2022 at 2:50pm
[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?...
Apr 9, 2022 at 10:46am
[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...
Apr 9, 2022 at 3:57am
[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.
Registered users can post in this forum.