Category "c++"

How do i write nested if statement? [closed]

So i want to make a simple if statement like this : if(a=1) { if(variable1=1) { cout<<"a1=1"; } else {

can I build a production level windows application in Python

I'm trying to build a Windows Application in Python. But, sometimes I question myself, can this Application run on another person's PC without installing Python

std::stringstream's seekg does not work after while loop

I have this std::stringstream object whose contents I have to read (only) twice. For this I thought I could use its seekg member function to repeat the reading.

extern "C" DLL: Debug is OK, Release throws Error C2059

I've got a DLL that I've created as a C++ Win32 application. To prevent name mangling in my DLL, I have used the EXPORT definition defined below: #ifndef EXPOR

Is there any way to control optimization of a template function in visual studio c++ 2017

I tried using #pragma optimize("", off) to selectively disable optimizations for the a() function. This does not work. Is there any way to control optimization

Time limit exceeded in GeeksForGeeks zig zig traversal in tree

I am working on the GeeksForGeeks ZigZag Tree Traversal problem: Given a Binary Tree. Find the Zig-Zag Level Order Traversal of the Binary Tree. Example 1: Inp

C2059 syntax error: ',' after upgrading to Python 3.9 from Python 2.7

I have a C++ application that runs on Python 2.7, today I decided to upgrade to Python 3.9 but ever since then I've been getting the following error in visual s

Getting Segmentation Fault error in C++ code

#include<bits/stdc++.h> using namespace std; //FIRST REPEATING ELEMENT (APPROACH 2) int main() { cout<<"running"; int n; cin>>n;

Move elements while reallocation elements in vector

I have the following code: #include <vector> #include <iostream> struct Data { Data() = default; Data(const Data& other) {

Issue overloading the operator c++

I keep getting the following errors Error (active) E0349 no operator "<<" matches these operands Error C2678 binary '<<': no operator found w

Is it possible to calculate the value after overflow?

I understand that if 1 is added to INT_MAX it will overflow and we will get the negative maximum. It is connected in a cycle. In the code below can I calculate

Api server rest with crow

I am implementing a server rest using Crow. In my code i want to do some action before sending the response. These action are complimented in another class. it

Passing enum to argument of integral type

Consider the following code: enum ABC : char { a, b, c }; void ff(char c) { cout << "char\n"; } void ff(int i) { cout << "int\n"; } i

What is the best way to solve multiple definitions introduced by a 3rd party library? [ELF and Mach-O]

Background Imagine the situation: static library libR.a is written rust and it depends on libCXX0.a. Binary X depends on both libR.a and libCXX0.a and it is wri

Azure IoT Edge C++ module not sending device to cloud telemetry

I have written an IoT Edge C++ module that is sending the event output using the following function call: bool IoTEdgeClient::sendMessageAsync(std::string messa

(solved) C++ Load one Shared Object with dependencies and access their functions

OS Linux Ubuntu 18.04, gcc 7.4.0 A program should load one SO which is dependent on other SOs. All exported functions of all SOs should be called by the program

In C++, how can one map between enum values and data types, so the types can be used in templates?

How can one do this, which is obviously impossible C++, in real C++?: Type decodeUiEnum(UiEnum myEnum) { // impossible: cannot return a data type // one sw

Icons resources dont work in small and list sizes

Have created project on c++ in Visual Studio. Have added resources.rc + .ico file, that have next positions: 32 bits: 64x64, 48x48, 40x40, 32x32,24x24, 20x20, 1

It is legal this approach for create a local variable in C++

I'm new to C++ and try to understand how to create and use a class in C++. For this I have the following code: class MyClass { public: MyClass() {

How to convert virtual key code to character code?

In the onkeydown() handler I am getting 219 as the keycode for '['; however, the actual character value of '[' is 91. Is there any way to map these two?