Posts by Vitor Matos • 505 points
20 posts
-
0
votes0
answers249
viewsQ: error with Bootstrap(Font Awesome)
I’m using Bootstrap and trying to add the incone "like", but it appears that square in place... what’s the problem? <link href="css/font-awesome.min.css" rel="stylesheet"> <!--codigo usado…
-
1
votes1
answer64
viewsQ: Modify >= 2D array using pointers
I would like to modify my matrix ( multiplying by 2 each of its elements) using pointers, but I don’t know why my code isn’t working... #include<stdio.h> void changematrix(int **mm,int row,…
-
0
votes1
answer99
viewsQ: preecher array, struct in C?
how do I fill in leds and seq without needing a loop for? int main() { struct ledvalue { int seq[10]; int leds[10]; }; struct ledvalue numbers; numbers.seq={0,1,2,3,4,5,6,7,8,9};…
-
1
votes1
answer401
viewsQ: Array storage
I have a question about storing information in array, I thought, when inside a loop, an array of size 200, for example char nome[200] it would be populated continuously until there is no more space…
-
1
votes1
answer195
viewsQ: Scanning an entry by scanf does not walk in the string beyond the white space
I’m trying to make a program that reads a sentence and then capitalizes every initial of every word, if not already. The problem is that I type in a sentence but it only returns the first word,…
-
-1
votes1
answer478
viewsQ: Exercise: Turn decimal to binary and find 1’s
#include<stdio.h> int main() { int k,repeticao; int valor, numero; int paridade = 0; scanf("%d", &repeticao); for( k = 0; k < repeticao; k++ ){ int numero,sequencia; scanf("%lld",…
-
3
votes1
answer3361
viewsQ: Loop for inside loop for
for(pass = 0; pass < size - 1; pass++){ for(j = 0; j < size - 1; j++){ if(array[j] > array[j + 1]){ swap( &array[j], &array[j + 1]); } } } I put only a piece of code where I have…
-
8
votes3
answers3514
viewsQ: How to store any string in C?
How do I store a string (input) without knowing the size of this string, for example: #include<stdio.h> int main (){ char nome[]; /* a array não tem tamanho determinado porque o input ainda…
-
-1
votes1
answer694
viewsQ: Error using Pow(a,b)
#include <stdio.h> #include<math.h> int main() { double pi = 3.14159; double R, A; scanf("%lf", &R); A = (pi)* pow(double R, int 2); printf("%lf\n", A); return 0; } This code is…
-
2
votes1
answer66
viewsQ: Different values between variable without value and variable with null value?
#include<stdio.h> int main ( void ){ int die1[7]; int die2[7]; int sortedDie, i; srand(time(NULL)); printf("Rolling die 1\n"); for( i = 0; i < 6; i++){ die1[i] = 1 + rand()%6; }…
-
1
votes3
answers481
viewsQ: Doubt with float
#include<stdio.h> int main ( void ){ float y = 12.0809; printf("The number %.2f is a float\n"); return 0; } I know that %.2f is used to consider only two decimal places, but would like to know…
-
1
votes3
answers71
viewsQ: Compiler accusing error I don’t know
#include<stdio.h> int sumofDie(int value1, int value2); int main( void ){ int die1[7]; int die2[7]; int i; srand(time(NULL)); printf("Rolling die 1 ..........\n"); for( i = 0; i < 6; i++){…
-
0
votes1
answer135
viewsQ: Word in reverse order
I’m doing an exercise where I have to make the word given with input exit in reverse order. I start by counting the number of letters you have in the typed word (commented on in the code). After…
-
3
votes3
answers962
viewsQ: Printing a character in place of a number
#include<stdio.h> #include<string.h> int main() { char str[50]; int i, l = 0; printf(" We will count the number of letters\n"); printf("-------------------------------------\n");…
-
1
votes2
answers76
viewsQ: Error while running script
#include<stdio.h> #include<math.h> int main ( void ){ int x; int i; printf("Input the number (Table to be calculated) : "); scanf("%d", x); for( i = 1; i <= 10; i++){ printf("%d x %d…
-
-1
votes1
answer493
viewsQ: For without the use of key
#include<stdio.h> int main ( void ){ int row; int column; for ( row = 1; row <= 7; row++ ){ for (column = 1; column <= row; column++ ) printf("*"); printf("\n"); } printf("\n"); } I want…
-
4
votes3
answers216
viewsQ: Why is there an asterisk left?
I want the number of rows and columns to be equal to input data. Why is this last *? Code: #include<stdio.h> #include<math.h> int row = 0; char column = 0; int n; int main ( void ) {…
-
6
votes1
answer1353
viewsQ: How to return or extract more than one value from a function?
integerPower( int y ){ int base2; int base3; int base4; int total; base2 = pow( y , 2); base3 = pow( y, 3); base4 = pow( y, 4); When I call this function (I did not type return because that’s the…
-
4
votes2
answers1267
viewsQ: Variable declaration before the main() function and after the main() function in C
What is the difference between declaring any variable (in this case number) before function main()? int number = 0; int main() { printf(" The number is %d\n", number); return (0); } and after it.…
-
0
votes1
answer540
viewsQ: Program to calculate media
#include <stdio.h> #include <stdlib.h> int main() { int sum = 0; int times = 0; int number; int average; while ( number != 9999 ){ printf( " Type the number and i will make the average,…