General C++ Programming - April 2021 (Page 6)

getpid() linux
 
I need to get pid for every processes. In process I get sum of every arrays. In the I get max sum. I wrote programm but I have doubt. Can you check it? #in...
[4 replies] Last: The printed pid's look good. What did you want to know? I start to ... (by onetwo123)
C++ Question
 
hi I am supposed to add code and I tried and for some reason the program isnt running!I feel Like I am making a small mistake lol #include <iostream> #includ...
[1 reply] : Look at line 9, your function declaration of unmix. You are telling t... (by deleted account xyzzy)
Array question
 
(Question) Write a C++ program that includes the following: Declare an integer array of size 10 Ask user to enter 10 numbers for the array Print out the ar...
[9 replies] Last: oh wow thank you sire , kinda fiqured I was messing up in the int part... (by Sunnycoder)
by cmisip
How to optimize this code for Encode float to int and Decode int to Float
 
I am trying to build an algorithm for compressing 4 byte floats into a custom 2 byte uint16_t. I plan on sending a lot of data through the serial line from one...
[4 replies] Last: A lot of data needs to be sent through the I2c bus which is why I chos... (by cmisip)
by frek
Merge file using std::merge
 
Hi all, The exercise says we need to merge two text files into a third one suing std::merge . Since that algorithm works only with iterators and only STL cont...
[5 replies] Last: Texts like these" Banana Trees 80 Pounds 123 Jack Sparrow Jungle sur... (by frek)
by MdP
placement new, in an exported template in a module
 
Hi, I'm converting an existing codebase to use C++20 modules, using Visual Studio 2019. Let's say I have a module X, exporting a template class C whose impl...
[no replies]
How can i call a derived class method using a base class object ?
 
I understand how this goes in the opposite direction. But for various reasons i want to use a base class object to call a derived class method Let's say we hav...
[1 reply] : First, you should avoid using variable names like 'x' and 'y' (outside... (by Ganado)
I have a problem with this code i don't able to update my dates in admission and date of birth
 
#include <iostream> using namespace std; class date { private: int day{1}; int month{1}; int year{2021}; int days {31, 28, 31, 30, 31, 30, 31, 31,...
[5 replies] Last: It is also nice if you include proper formatting as well. Just copy a... (by JRManx)
by VoB
Not all lvalues can be on the l.h.s. of an assignment
 
Hi everyone, I'm trying to go a understand a bit deeper the concept of lvalue, xvalue,glvalue,rvalue,prvalue from "The C++ Programming Language, 4th edition". ...
[4 replies] Last: Thanks @helios Indeed that if clause would lead to some troubles... f... (by VoB)
Have some issues with my code. It return a strange address instead of class parameters values. Can anyone help me , please ?
 
Hey there ! I have an issue with my code , something about my virtual function and input/output operator and i don't know how to fix it. I apologise in adva...
[3 replies] Last: friend istream &operator>>(istream &input, C &o3) { ... (by dhayden)
by yin
Program won't go inside of if statement
 
I tried debugging as well and outputted both the coin face and the toss selection, right before the if loop. The coin face would show as heads and the toss sele...
[1 reply] : srand() should only be used once at the beginning of main() For the t... (by seeplus)
by RicoJ
std::packaged_task constructor
 
It seems that there's a difference between () and = constructor (ctor) here. #include <functional> #include <future> int addNumbers(int a, int b) { return ...
[1 reply] : Line 7 performs copy-initialization while line 8 performs direct-initi... (by mbozzi)
by RicoJ
Ambiguous Function Call?
 
My understanding for function call sequence is: exact matching function > template function. However, below code yields "error: reference to ‘negate’ is a...
[10 replies] Last: Hi guys, Y'all have raised some very nice points! Yes, I did have #... (by RicoJ)
Can I Write iOS/Android Apps with C++?
 
I've finished a library of functions for calculating sunblock data, in C++. Is it possible to use my C++ library for iOS or Android apps?
[3 replies] Last: Yes, although since running apps from the command line is not for ever... (by JRManx)
Pixel Art
 
So, quick Q. How would I use Pixel Art in Visual Studio 2019? I would just want to do a few Animations and maybe a short game, but it is currently beyond my kno...
[4 replies] Last: Panda, your question is fine here, it's just that the answer is a lot ... (by Ganado)
How can i clean my messy cod
 
Hi everyone. Im a newbie, because of that i apolige. I have a messy code. I want to clean it and want it shorter. How can i do it? if(item->parent() ==...
[19 replies] Last: Messy cod tartare with Mongolian tartar sauce made from tooth plaque. ... (by JRManx)
Find word in a string array
 
So i have made a program that reads a file and stores the content in a wstring variable (Needs to be a wstring as the file contains ANSI characters which i wont...
[5 replies] Last: Is this what you're after: #include <iostream> #include <fstream> #... (by seeplus)
copy constructor is deprecated if copy assignment operator or the destructor is user-declared ????
 
I do not understand how a copy ctor can be deprecated when either of the special functions mentioned is user declared... How can the compiler create the copy...
[1 reply] : Currently the C++ compiler will write a copy constructor and copy ass... (by mbozzi)
Why Cant i used non-static variables for default argument assiment
 
struct X{ int var; void do_stuff(int i = var){...}//compilers want me to make var static };
[7 replies] Last: @mbozzi oh man you are right Thanks!! (by Kallinteris Andreas)
April 2021 Pages: 1... 45678
  Archived months: [mar2021] [may2021]

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