Posts by Lolzeiro • 103 points
12 posts
-
-2
votes3
answers405
viewsA: Make a program that reads an integer N and then print the N first odd natural numbers
#include<stdio.h> #include<locale.h> int main(){ setlocale(LC_ALL,"portuguese"); int n,aux=0,vezes; printf("Digite um número:\n"); scanf("%d",&n); vezes=n; if(n!=0){//para Zero n ser…
-
-2
votes1
answer52
viewsQ: Runtime recursive function
How I calculate the running time of a recursive function? public void ordenar(int vetor[],int i,int f){ boolean aux2=true; int inicio=i,fim=f; while(i<f){ if(vetor[i]>vetor[f]){ int…
-
-2
votes1
answer50
viewsQ: POO doubt object
I have a question about POO... Classe objeto=new Classe(); ...from what I understand, we create a variable that receives a reference from the created object. In a simple chained list when I delete a…
-
0
votes4
answers1648
viewsA: Count consonants in the sentence
#include <stdio.h> #include <stdlib.h> #include<string.h> int main() { char consoantes[]="bcdfghjklmnpqrstwvxyzç",frase[30]; int…
-
0
votes4
answers1648
viewsA: Count consonants in the sentence
I decided, I wasn’t paying attention was that the space counted as character,and that the size of the string increased with the space key. #include <stdio.h> #include <stdlib.h>…
-
3
votes4
answers1648
viewsQ: Count consonants in the sentence
The program must count the number of consonants in the sentence. If only one word is typed it counts right, but if I give space, ie, write a sentence it does not count right. #include…
-
2
votes2
answers78
viewsQ: Invert a string correctly
I cannot print the vector backwards, in this case, the word typed has to have exactly 6 letters. It follows the code: #include <stdio.h> #include <stdlib.h> int main() { char…
-
1
votes1
answer332
viewsQ: Count number of lines in the file
Good morning,this function counts the number of lines of a file,but it has a little problem,it only counts the line when it finds the n,for example to test it,I would create a text file,and write a…
-
1
votes1
answer1383
viewsQ: Read only one line in the file
I want fgets,take only one line and not the entire file,how do I do it in C? If I print the word variable in the function it prints everything and also would like to return that line in main.…
-
-1
votes1
answer449
viewsQ: Return a string in C
Good morning, I want to return a word that is in a file,. #include <stdio.h> #include <stdlib.h> #include<locale.h> #include<string.h> int *abrir_arquivo(){ //o cursor ira…
-
0
votes0
answers17
viewsQ: Struct error reading second name
Good afternoon, I’m doing a struct that stores name and age,the first step of the loop,but when it goes to read the second name it jumps,. #include <stdio.h> #include <stdlib.h>…
-
2
votes2
answers106
viewsQ: Make a game continue or stop as the player chooses
In this game the player chooses a limit number and from this limit will be drawn a number and the user needs to hit it, I’m doing with function, but I do not know how to call again if the user wants…