Questions tagged as 'c'

3
answers

How to read only integer numbers in scanf?

For example, in the code: int main() { int x; scanf("%d", &x); printf("%d", x); } If I type "A", it automatically converts to integer or just closes the program (the two have already happened to me). there, in the c...
asked by 15.10.2018 / 21:31
2
answers

How to read variable from another program?

I'm learning programming and I would like to know: how do I make the program read the value of a variable from another program (theoretically this would be without "awareness" of the program read, I do not know exactly how this works, some permi...
asked by 09.08.2014 / 04:01
2
answers

Mysterious Square

   The whole numbers positioned in a square NxN such that all lines and main diagonal have the same sum.       For example, the square below 2 7 11 9 5 6 4 3 13       is a mysterious square of sum 20, since all lines (2 + 7 + 11 = 20, 9 +...
asked by 03.07.2018 / 06:34
3
answers

How to sum all the numbers in the while sequence?

How to add from 1 to 64 in while ? I wanted to make the sum 1+2+3+4+...+64 print the value of the sum by the end. What I've tried so far: #include <stdlib.h> #include <stdio.h> int main(void) { int numero= 1...
asked by 15.02.2018 / 16:43
3
answers

Calculate the standard deviation of a vector

I can not solve the following equation: Hereisthecode:#include<stdio.h>#include<math.h>intmain(){floatm,media,sigma,p;intvetor[10];media=0;m=0;sigma=0;p=0;for(inti=0;i<10;i++){printf("Digite um número: "); scanf("%d",...
asked by 30.10.2017 / 03:51
1
answer

How to sort two vectors (ascending order) in a third vector using only one loop?

My teacher has posed this problem and I am not able to sort in ascending order just by using a loop to sort. #include<stdio.h> main(){ int i,a[5]={1,4,8,9,11},b[5]={3,6,7,10,15},c[10]; for(i=0;i<10;i++){ if(a[i]<...
asked by 14.04.2018 / 20:03
2
answers

Center printf

Personal how do I centralize messages, simple texts? printf("CLÍNICA DE ANÁLISES LABORATORIAIS\n\n"); printf("TRIAGEM ADMINISTRATIVA\n\n"); These two lines above are within main . I would like to center them on any console.     
asked by 06.06.2017 / 04:47
1
answer

MySQL error connector / C

I have a problem in C, trying to include the MySQL bookstore gave some strange errors that I did not find anywhere. I downloaded the bookstore on the official site for Win32-x86 (ZIP) and installed it on MinGW (32-bit , latest version with...
asked by 29.06.2017 / 01:30
2
answers

No match for 'operator ==' in find function C

TipoApontador find (TipoItem x, TipoLista *lista){ TipoApontador aux; if (lista->primeiro != NULL){ aux = lista->primeiro; while (aux!=NULL){ if (aux->item == x) return aux;...
asked by 21.10.2018 / 21:54
2
answers

Cast in sockets

Galera wanted to understand what reason to do these cast below, is it just for aesthetics? What does this really affect in the code? struct iphdr *ip; char *buffer ip = (struct iphdr*) packet; icmp = (struct icmphdr*) (packet + sizeof(...
asked by 31.01.2016 / 16:32