Category "c++"

Why does std::getline() skip input after a formatted extraction?

I have the following piece of code that prompts the user for their cat's age and name: #include <iostream> #include <string> int main() { int a

Invalid conversion from char * to int fpermissive

#include<iostream> #include<vector> using namespace std; int main(int argc,char** argv){ int n; if(argc>1) n=argv[0]; int* stuff=new int[n];

My pointer does not point on the same value when its call in a slot QT C++

I do a pokemon project with a Qt interface. I created a class Trainer and Pokemon : class Pokemon { protected: string itsName; doub

How does object initialization ambiguity get resolved?

The class has two constructors, one that has no initialization value and does not increase the 'val', the other takes a reference to an object, and increases 'v

Error while executing a c++ umat in Abaqus

This is a simple Linear elastic umat written in c++.When i try to run a abaqus job for a simple model using the below code, Abaqus give me the following error

Generating compile time functions string for formatting strings with libfmt

I want to create a nice table in stdout. The table has a lot of headers that are mainly compiletime strings. For example: std::cout << fmt::format("|{0:-^

AddressSanitizer:DEADLYSIGNAL error when trying to run code using stack for valid parenthesis problem set

I was trying this problem called valid parenthesis on leetcode.com when an error popped up saying this: AddressSanitizer:DEADLYSIGNAL ==========================

Can we unit test memory allocation?

I have to test a library that provides its own memory allocation routine: void* allocation_routine(size_t size) throw(); Documentation states that this funct

QPolarChart hide radial tick labels

I have created a QPolarChart and I want to hide the radial tick labels but leave the tick circles. I simply want to get rid of the text which shows "0.0", "20.0

Setting age in Parellelised game of life

I am a university student and my teacher is making us to create a prey/predator simulation with OMP for. I had covid during his lectures and he didn’t upl

Convert between std::u8string and std::string

C++20 added char8_t and std::u8string for UTF-8. However, there is no UTF-8 version of std::cout and OS APIs mostly expect char and execution character set. So

Convert between std::u8string and std::string

C++20 added char8_t and std::u8string for UTF-8. However, there is no UTF-8 version of std::cout and OS APIs mostly expect char and execution character set. So

Qt C++ : Cannot instantiate class derived from QAbstractListModel

Using Qt wizzard I created ToDoListModel2 class derived from QAbstractListModel. Code: todolistmodel2.h #ifndef TODOLISTMODEL2_H #define TODOLISTMODEL2_H #incl

Is it possible to make mods in C++ for the bedrock edition on a Windows 10 PC?

(thread title) bedrock minecraft more recognizable as "Windows 10 Edition" Minecraft, is it possible to create a sub category UI menu similar to that in Java mi

JNI: SIGSEGV when calling native function from Java, after native registration of same function on library second opening

I have an Android app that is structured in the following way: CORE: Is the class of the accessibility service that dinamically loads a few dex files. It will b

C++ in vscode: error: no matching constructor for initialization of 'std::thread'

I just started to use vscode and I did a tutorial about multithreading in c++. The code below is just the same as the tutorial and I'm sure the code works in vi

"No tests were found!!! " in cmake tutorial step 4

The contens of CMakeLists.txt: cmake_minimum_required(VERSION 3.10) # set the project name and version project(Tutorial VERSION 1.0) # specify the C++ standar

C++ friend template function: Function definition not found

While trying to wrap my head around C++ templates I have run into a compiler warning I do not understand. In below vec.h Visual Studio 2019 will put a green squ

I have to put an alphanumeric password in a text file

Here's the code: #include <iostream> #include <fstream> #include <string> #include <cstdlib> #include <ctime> #include <windows

How to use a Third-Party DLL in Visual Studio Code

I have a couple of header files that call functions from DLL files, and I was wondering how I could provide the link for the header files and DLL files to commu