Questions tagged as 'c++'

1
answer

Create type using class of a structure, and use the same type within the class

Currently I need to create a collection of classes representing nodes (fragments) of the AST (abstract abstract tree) of an interpreter. Now, for example, I'll give an overview of C ++ templates and try to declare two members ( left and...
asked by 17.04.2017 / 03:15
1
answer

User and password validation in C

I'm making a game that needs authentication to play. How do I validate user and password saved in a .txt file? The code I've developed so far is this: void login(){ int escolhe_dificuldade(); // função para selecionar dificuldade do jogo...
asked by 27.05.2017 / 16:30
1
answer

How to pass string as a parameter in C ++

Oops, people, easy? Next, programming teacher passed a little project and I need to pass a string as a parameter in C ++. How do I do? I've seen it on the internet and none of the ways worked. I tested it like this: void text_to_morse(st...
asked by 10.04.2017 / 01:57
2
answers

Major / Minor / Sum in C ++ using 'for'

I want to make a program that reads 5 numbers and tell me the largest number, the smallest number and the sum of the numbers, in C ++ using the for loop. I tried and did so: #include <iostream> using namespace std; int main()...
asked by 08.04.2017 / 13:19
1
answer

Why does not Clang recognize the basic header (iostream)?

Command line: clang++ "C:\caminho\completo\helloworld.cpp" -o "C:\caminho\completo\helloworld.exe" Code: #include <iostream> using namespace std; int main(){ cout << "Ola Mundo" << endl; return 0 ; } E...
asked by 14.03.2017 / 23:33
1
answer

I can not pass one vector per parameter in C

I'm trying to pass one vector per parameter to a function in C, but I'm experiencing difficulties. #include <stdio.h> #include <stdlib.h> #include <math.h> void calculafx( x2, *f3, *f4, m){ int j; float fx1=0; for(j...
asked by 18.02.2017 / 15:29
1
answer

sprintf does not give the expected result

I have variables of type Unsigned Long Int and would like to save its value in string , to perform checksum and send via serial communication.     void Payload (int long unsigned lastTime, float deltaOne, float deltaTwo, int factor...
asked by 16.02.2017 / 12:36
1
answer

Doubt how to get a JSON, transform into object

I have a little doubt about a json module in c ++, I was wondering if there is any way to get a json that already exists and increment more fields using c ++, json data = json::parse(getData()); FILE * pFile; pFile = fopen("data.json", "a"); f...
asked by 26.03.2017 / 07:41
1
answer

Two readers on arduino

As this code I read the card and inform if it is registered or not. Now I need to insert two rfid readers into the Arduino. How to add the second rfid reader in this code? include SPI.h include MFRC522.h define LED_VERDE 6 define LED_VERMELHO...
asked by 17.03.2017 / 10:42
1
answer

Avoid leakage of memory as a function of return

You have an exercise in the C ++ workbook that asks you to create a function that returns an object by preventing memory leakage. I did so but I'm not sure if it really works: class Point1{ public : int x; public : int y; Point1(i...
asked by 03.01.2017 / 17:18