Questions tagged as 'c'

1
answer

How to check if the user input is a negative number and display an error message?

The statement says:    Write a program that reads multiple integers and positives and calculates and shows the largest and smallest numbers read. Consider that:   To terminate data entry, zero must be entered.   For negative values, a message...
asked by 18.12.2017 / 00:42
1
answer

Variable type float does not receive valuation [closed]

Here's a snippet of code: #include <stdio.h> #include <stdlib.h> #define MVAIN 0.8592; #define MVAOUT 1.0282; #define ICMS 0.29; float ProdValue = 0, MVA = 0, ResultValue1 = 0, ResultValue2 = 0, ResultValue3 = 0; int main(){...
asked by 19.03.2017 / 18:33
2
answers

How to give value to a char variable?

I have a question about how I can give value to the variable char without being by the scanf command, for example: I have a variable named name and I mean that it is worth maria. how do I do that? I tried everything and I can not: p     
asked by 14.08.2018 / 01:17
1
answer

Function that converts string to lowercase and compares [duplicate]

struct registro{ /*Estrutura para guardar os dados do usuário*/ char usuario[50]; }atual[1000], *ptr; main() { int v = 0; verific = 0; //posicao e variavel para comp. de string volta_usuario: printf("\n\t\t\tUsuário: "); gets(atual[v].usuario)...
asked by 03.11.2017 / 03:59
1
answer

Why do not my strings concatenate correctly?

I want to display information in the following format: last name / last name. But he jumps a line in the concatenation. At least that's what I think is happening ... #include <stdio.h> #include <stdlib.h> #include <string.h>...
asked by 12.09.2018 / 21:10
1
answer

Sublime text with exit code 1. How to solve [closed]

I have this ERROR when trying to compile any code in C on my PC : [Decode error - output not utf-8] [Finished in 0.2s with exit code 1] I installed MinGW and modules gcc(C++ e C) , but still give me this error, althou...
asked by 18.11.2015 / 22:40
1
answer

Problems generalized in C [closed]

#include <stdio.h> #include <string.h> #define Nome "nome" #define TAM_STRING 12 void main(void) { char * str; str = (char*) malloc(TAM_STRING); if(str == NULL) { printf("Não já espaço para alocar"); }...
asked by 16.04.2015 / 14:29
1
answer

Selection structure, use of for

I need to select animals over (60 months), and return their consumption and monthly production, as I have tried to idealize in the equations. However, it does not return any numbers correctly. for(i=0; i<3; i++) { printf("\n\nInform...
asked by 22.11.2015 / 22:48
3
answers

How to create a function that divides two numbers into C? [closed]

How to create a function that divides two numbers into C?     
asked by 01.06.2018 / 01:09
2
answers

How do I do if the user enters a number other than 1 and 2 he asks do you want to end the program? \ n [1] for yes and [2] for no? [duplicate]

#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main() { int var1, var2, Q, R, decisao; printf("Dividindo dois numeros\n\n");...
asked by 14.06.2018 / 15:38