Questions tagged as 'c++'

2
answers

Is std :: function equivalent to a pointer?

I was practicing with lambdas and I found the following code: auto make_fibo() { return [](int n) { std::function<int(int)> recurse; recurse = [&](int n){ return (n<=2)? 1 : recurse(n-1) + recurse(n-2); };...
asked by 05.11.2015 / 01:26
1
answer

How to implement a class that inherits from QGraphicsItem and behaves like a QGraphicsItemGroup

I am working on a project where I needed to inherit from the class QGraphicsItem of Qt since I needed to have QGraphicsItem with special features (modification of line size, depending on the zoom, setting the boundingRect to the fo...
asked by 21.09.2018 / 10:55
1
answer

C ++ about the format of output text strings

is my first question in the forum. I come from a past in the programming in C "plain" for saying it in some way. Now I have a linux mint installed and I'm using g ++ to learn C ++ and a couple of books and tutorials. Here the output format...
asked by 14.12.2017 / 01:48
1
answer

How to extract a number from an almost random string in C ++ using regular expressions [closed]

How to extract a specific number from a string that can have almost any shape, I explain: My string can be: cualquiercosa+CH+number+cualquiercosa that is: TEST-13?:41CH12f:A1345 I just need to extract the number that f...
asked by 19.01.2017 / 12:17
1
answer

Junk when I use a while loop in C ++ with iterators

I want to insert a number in the second position using an iterator, then I present it on the screen, but I get trash. #include <iostream> #include <vector> using namespace std; int main() { vector<int> v(4); for(int...
asked by 29.01.2017 / 15:36
3
answers

How to read numbers separated by commas in c ++?

I hope you are well. I would like you to help me please read numbers separated by commas in C ++ language, I know that java uses the split function but I am new to c ++ and I do not know how to do it. It is to be added to a matrix with its...
asked by 05.12.2017 / 17:34
1
answer

How to upload a text file to a Linked List in C ++?

How about my problem is as mentioned in the title, I have knowledge of how to make simple and double lists linked in c ++, but I have no idea how to pass information from a text file to a simple list. I have a program created in c ++ with indexe...
asked by 17.09.2016 / 07:32
1
answer

memset does not work with large numbers

I have the following simple code: #include <bits/stdc++.h> #define oo 0xffffff using namespace std; int main() { int v[10]; memset(v, oo, sizeof(v)); for(int i = 0; i < 10; i++) cout << v[i] << endl;...
asked by 30.10.2017 / 18:50
2
answers

Help with (const vectorint & t: flights), in floyd algorithm

//vector<vector<int>>& flights //vector<vector<int>> vec(n, vector<int>(k + 1)); for (int i = 1; i <= k; i++) { for (int j = 0; j < n; j++) { vec[j][i] = vec[j][i - 1]; for (const v...
asked by 12.11.2018 / 23:43
2
answers

c ++ - Preprocessor - Existential doubt

I really have a doubt in existence, and as I go on it makes me more noisy and I really do not know if I'm doing things right. I have my own software, which I developed a few months ago ... it goes quite well in its purpose, but it turns out that...
asked by 27.11.2018 / 15:23