Questions tagged as 'scanf'

1
answer

Power function returning incorrect values inside the while loop

I have a function power that returns the value of a potentiation by receiving the parameters n and p ( n^p ). Out of the loop while the function returns the correct values, however inside the loop the functi...
asked by 05.05.2018 / 17:11
1
answer

Scanning an entry by scanf does not move in the string beyond the blank space

I'm trying to make a program that reads a sentence, and then put each word initial in capital letters, if not already. The problem is that I type a sentence but it only returns the first word, nothing more. the word is with the first capital let...
asked by 06.03.2017 / 01:42
1
answer

Is the null character \ 0 automatically placed at the end of the string or does it not put because I set the scanf limit?

#include <stdio.h> #include <stdlib.h> int main(void) { char nome[20]; char sobrenome[20]; char nomeSobrenome[40]; printf("Insira seu nome e seu sobrenome:\n"); //scanf("%s%s", nome, sobrenome); scanf("%[A-Z...
asked by 03.09.2018 / 22:43
2
answers

Program Ignoring Scanf

I need to create an algorithm as a request below, however, every time I run the program it "skips" steps. For example: I want you to stay like this Product: "Potato" Sector: "Food" Quantity: "15" Price: "15.23" But it prints on...
asked by 13.05.2018 / 22:12
2
answers

How to analyze the input in the while condition?

I'm learning C, and as the language in which I was "literate" is Python, I usually make associations to assimilate better. In Python, I can get a direct value in the while condition. Ex.: while int(input()) != 0: faça isso It is also...
asked by 24.12.2017 / 05:25
2
answers

Simple declaration of a variable for scanf

I already know how to declare a variable in the traditional way using scanf() , but I'm thinking in a way that I can use fewer rows and make the code more organized (this is what I tried with the variable valor ). / p> It turns out...
asked by 15.09.2017 / 02:58
1
answer

Program does not wait to read content received

I am creating a program that reads the student's name, the number of absences, 3 grades and returns if the student has passed, failed for failure or failed by average, knowing that the limit of absences is 15, the minimum grade for approval is 7...
asked by 25.02.2017 / 16:10
1
answer

I have an error in scanf

I have to read N lines with one of the following 3 formats: P k ": the letter P followed by k where k is an integer; A : the letter A followed by k being an integer; " Q ": the letter Q . As I do not know if the person goes by...
asked by 09.04.2016 / 03:27
2
answers

How to stop receiving keyboard digits?

This is a game of memory and while the numbers are being displayed I want the user can not type. **for (i=0;i<2;i++) //Exibe os números que estão no vetor numeros[] { printf ("%d\t...
asked by 07.05.2018 / 17:54
1
answer

Validation of scanf in c

I have a problem that I need to validate an entry to receive only integers, if I do not receive it, I should force the user to type an integer. I can not disregard numbers after the comma (in the case of decimals) and I can not return the entire...
asked by 25.10.2016 / 14:31