agrego practicas

This commit is contained in:
2026-10-31 11:14:30 -03:00
parent 392cf493d1
commit f4f56db493
50 changed files with 1899 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc build active file",
"command": "/usr/bin/gcc",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
Executable
BIN
View File
Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
este es un archivo
de texto
Executable
BIN
View File
Binary file not shown.
+42
View File
@@ -0,0 +1,42 @@
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
int count_words(char*);
int main(void){
char buffer[50];
int total_words = 0;
while((fgets(buffer, sizeof(buffer), stdin)) != NULL){
total_words += count_words(buffer);
}
printf("El total de palabras es: %d\n", total_words);
return 0;
}
int count_words(char* line){
int palabras = 0;
bool hay_espacio = false;
printf("line: %s", line);
if((line[0] != ' ') && strlen(line) > 0){
palabras++;
}
for(int i = 0; i < strlen(line); i++){
if(line[i] == ' '){
hay_espacio = true;
}
if((line[i] != ' ') && (line[i] != '\n') && (hay_espacio)){
palabras++;
hay_espacio = false;
}
}
return palabras;
}
BIN
View File
Binary file not shown.