Questions tagged as 'c++'

1
answer

Error: can not convert float * to float

Error found on line: quadrados = (desvio_qualquer * desvio_qualquer); Error: Can not Convert Float * to Float #include <iostream> #include <string.h> #include <sstream> #include <cmath> using namespace std; struct...
asked by 09.06.2014 / 01:49
2
answers

copy an entire txt file to a string in c ++

Is there a function that copies a txt file to disk and transforms it into a string, without copying character by character in c ++?     
asked by 02.07.2018 / 02:17
2
answers

How do I use% d or% c ... in the cout statement?

I am studying C and C ++ and would like to understand how I could transform this code written with printf() into cout , or how to use the %d %x %c , etc. functions. no cout . int main() { printf("i make...
asked by 02.08.2018 / 18:09
1
answer

how do I solve this exercise in c / c ++

In the end I still have to figure out which stores are showing a price within the media, someone helps me; #include<bits/stdc++.h> struct difsites{ double preco; char loja[50]; char site[50]; }; int main(){ int i,j; d...
asked by 23.06.2018 / 03:56
2
answers

Insert Image and music into a c ++ project [closed]

Hello, what library allows me to insert images and music into a c ++ project? Does the SDL2 library allow? Right now I have the snake game running just on the console, but I would like to put a background image, something funnier. Thanks and...
asked by 03.08.2018 / 13:31
1
answer

Wrong calculation

#include <stdio.h> #include <stdlib.h> float dobro_do_maior(float x, float y) { float dobro; if(x > y) { dobro = x * 2; }else{ dobro = y * 2; } return dobro; } void main() { float a, b...
asked by 25.11.2018 / 20:39
1
answer

Memory leak in return

I'm reading a book and I came across this code: class SimpleCat { public: SimpleCat (int age, int weight); ~SimpleCat() {} int GetAge() { return itsAge; } int GetWeight() { return itsWeight; } private: int itsAge;...
asked by 04.01.2017 / 00:37
2
answers

scanf shows number always as pair

I have a problem and I do not know how to solve it because I'm starting to use Dev-C ++ now. I do not know much about it, the problem is the following I was able to solve a bug I was having, which was the use of % . Now I have another prob...
asked by 03.04.2014 / 19:46
1
answer

In the string transp, it was to appear all 4 names, however, only the last [closed]

#include <iostream> using namespace std; void texto(); void soma(int n1, int n2); int soma2(int n1, int n2); void tr(string tra[4]); int main(){ int res; string transp[4]=("carro","moto","barco","aviao"); soma(15,5); res...
asked by 09.02.2018 / 03:35
1
answer

Read the elements of a struct in another function

I need to access struct data in my CalcN function, how should I proceed? int main(){ int calcn(); struct user1{ string Nome; int Dnx; int Nxhu; }; struct user1 x; x.Dnx = 4; x.Nxhu = 3; int Resultad...
asked by 25.11.2014 / 23:28