Questions tagged as 'c++'

1
answer

invalid digit "9" in octal constant arduino

I have a problem with my temperature measuring function. #include "max6675.h" int ktcSO = 8; int ktcCS = 9; int ktcCLK = 10; MAX6675 ktc(ktcCLK, ktcCS, ktcSO); void setup() { Serial.begin(9600); delay(500); } void loop() { Serial...
asked by 31.01.2018 / 16:37
3
answers

Decimal to octal conversion

I need to create an algorithm that converts decimal to octal, but my conversion is wrong, can anyone help me how would it be right? #include <stdio.h> int decim(int n) { int i,a; int octal; if(n<=7)...
asked by 27.05.2018 / 01:06
1
answer

What's wrong with double variable

I need to make an algorithm that the user informs two values and return the largest between them using double, but at the time of compiling it from the error pointing something in the double but I do not know how to solve, someone can help me an...
asked by 29.05.2018 / 23:18
2
answers

How to avoid array overflow in C ++?

My program was showing strange behavior, until I discovered that there was an overflow of array , for example: int arr[3]; for (int i = 0; i<10; i++) { arr[i]=i; cout << arr[i]; } In this light example, i exceeds th...
asked by 12.05.2018 / 15:26
3
answers

Temperature converter

When I type the temperature in Fahrenheint the program returns 0 as a result, where is the error? #include <cstdlib> #include <iostream> #include <conio.h> #include <string.h> #include <math.h> using...
asked by 26.02.2018 / 14:27
2
answers

Why "segmentation fault" when merging two arrays?

I'm building a simple c / c ++ program that merges two arrays but I'm encountering an inconvenient error. I believe that when calling the function IntercalarArranjos , the program presents an error of type "segmentation fault". I do n...
asked by 07.01.2016 / 16:37
2
answers

My struct declaration is wrong?

#include <stdio.h> #include <stdlib.h> fun1(int ptr,int data) { data.ano=1990; data.mes=5; data.dia=15; ptr->nome="Bigown"; ptr->cpf="040502016"; } int main () { typedef struct { int ano; int mes;...
asked by 04.05.2016 / 20:15
1
answer

Passing Array as a parameter of a function

How to pass a array to a function without having to report how many indexes it has? Reporting the size #include "stdafx.h" #include <Windows.h> void imprimir(int _array[], int _tamanho) { for (int i = 0; i < _tamanho; i++) {...
asked by 05.08.2018 / 10:11
1
answer

Why does this retyped code not work the same as the original?

I'm studying C ++ a short time and I want to train rewriting functions already done by me in C # only in C ++. I wrote a simple code that calculates a IV of a hash, very simple even, calling the same methods using the same argument in...
asked by 21.12.2017 / 23:03
1
answer

Use Import or Include in C / C ++?

#import <stdio.h> or #include <stdio.h> What is the correct way to use it? I was seeing videos on YouTube for some time.     
asked by 06.02.2018 / 22:38