• Welcome to Test Foro de elhacker.net SMF 2.1.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - eriklingeri

#1
Hola a todos! necesito ayuda u.u estoy haciendo un programa que calcule el promedio del trimestre, con y sin integradora, si o si tiene que tener vectores y funciones, no se si este bien, debe tener errores, pero la cuestión es que no se como solucionar esto.

el programa es el siguiente:

Code (c) Select
# include <stdio.h>
# include <conio.h>

float notas[3];
float prom(float notas[]);
float prum(float notas[], float);

int main(){
int a,i;
float t, J;
for(i=0;i<3;i++){
       printf("ingresé notas: ");
       scanf("%f",notas[i]);
}
printf("¿hay nota de integradora? si 1, no 2: ");
scanf ("%d", &a);
switch(a){

  case 1: printf("ingrese nota: ");
          scanf("%f",& t);
          J= prum ( notas ,  t);
          printf("el promedio del trimestre es: %f", J);
          getch();
          return 0;
         
  case 2: J=prom(notas);
          printf("el promedio del trimestre es: %f", J);
          getch();
          return 0;
}
getch();
return 0;
}
prom(float vec){
int i;
float pr, vt=0;
   for(i=0;i<3;i++){
vt= vt+vec;}
pr=vt/3;
return pr;};
prum(float vec, float k){
float pr, vt=0, r, p;
int i;
for (i=0;i<3;i++);{
vt= vt+vec;}
r=vt/3;
p=r+k;
pr=p/2;
return pr;};


y al compilarlo me muestra esto:

# Project: sad
# Makefile created by Dev-C++ 5.11

CPP      = g++.exe
CC       = gcc.exe
WINDRES  = windres.exe
OBJ      = asd.o
LINKOBJ  = asd.o
LIBS     = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc
INCS     = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include"
CXXINCS  = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++"
BIN      = sad.exe
CXXFLAGS = $(CXXINCS)
CFLAGS   = $(INCS)
RM       = rm.exe -f

.PHONY: all all-before all-after clean clean-custom

all: all-before $(BIN) all-after

clean: clean-custom
${RM} $(OBJ) $(BIN)

$(BIN): $(OBJ)
$(CPP) $(LINKOBJ) -o $(BIN) $(LIBS)

asd.o: asd.cpp
$(CPP) -c asd.cpp -o asd.o $(CXXFLAGS)


por favor necesito ayuda urgente :c


Mod: Los códigos deben ir en etiquetas GeSHi, el titulo debe ser descriptivo,el tema debe ir en el subforo adecuado... corregido