Questions tagged as 'c++'

1
answer

Polymorphism in C ++

What are the advantages of using the dynamic link objetoPtr->funcion(); on the static link objeto.funcion(); ? And why is it good to declare functions as virtual?     
asked by 13.04.2017 / 19:23
1
answer

Error previous definition of 'class Player' in C ++

Hello everyone I have a problem with my code compiled well I do not remember that I moved it and it gives me an error. Here I leave my code. #include <iostream> using namespace std; #include "Player.h" #include "Enemy.h" int main(){...
asked by 10.04.2017 / 20:04
1
answer

Program in C ++ stops working

We were asked to develop a program that teaches English. It is ready, but the problem is that after a certain time of running the program, it stops working and says that the program must be closed. Why is that happening? #include <ios...
asked by 21.12.2016 / 01:28
1
answer

How do I count the number of words in a text in C?

I have to do the following exercise:    Enter a character text using the function getchar( ) . Indicate the number of characters, words, and lines that form it. Show the order with explanatory signs. Consider as separators of valid word...
asked by 23.01.2017 / 21:16
1
answer

How to make the python for the same function as in c ++

python code nx = 5 ny = 2 a=[[0]*nx]*ny for x in range(0, ny): for y in range(0, nx): a[x][y]=x * nx + y print(x * nx + y) print("===========") for x in range(0, ny): for y in range(0, nx): print(a[x][y]) c +...
asked by 20.03.2017 / 05:16
2
answers

Singleton example in C ++ apply to QT

Hi, I want to apply this program that is done in c ++ to QT since I do it in another way but it seems not to be the correct one. What I usually do when I use this method, the singleton method, what I do is create a static object but what you hav...
asked by 22.10.2016 / 02:09
4
answers

Ladder poker in c ++

I have to make a program that identifies a poker hand in C ++. The user will say how many cards he has and he will write a number from 0-51, being 0 = king, 1 = as, 2 = two, 11 = jack, 12 = queen ... and 0-12 spades, from 13-25 they are diamonds...
asked by 13.10.2016 / 20:18
1
answer

Sort a list by a certain element of the C ++ class

The project is in CodeBlocks, what I want is that when you show the list, show them sorted by the "Key" field either ascending or descending. Or that the function insert the order and print them or vice versa. zapatos.h #ifndef ZAPATOS_H...
asked by 10.10.2016 / 03:44
3
answers

When printing an arrangement of 10 spaces, another number is printed too large

I can not understand how it prints that eleventh number .. Would someone with more experience be kind enough to verify it? #include <iostream> #include <stdlib.h> using namespace std; int ordenarArreglo(int *arr) { int i, j, tem...
asked by 12.11.2016 / 02:12
1
answer

How to compile a program from the visual studio console

Hello my question basically is if I have a file for example main.cpp it is possible to compile it from the console with the compiler and if that is how it would be since opening and closing visual studio is sometimes a bit slow. So that's basica...
asked by 17.11.2016 / 19:26