online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
//Proyecto 3 #include <iostream> using namespace std; int main() { //Declarar las variables int alumnos=0, guia=6, n1=20, n2=30; char decision='R'; float suma=0, max=0, min=5000, alumno=0, alumno2=0, alumno3=0, alumnoprom=0, ran1=0,ran2=0, promedio=0; cout<<"Ingrese el numero de alumnos: "; cin>>alumnos; if(alumnos<n1 || alumnos>n2){ cout<<"Ingrese nuevamente el numero de alumnos; un numero que se encuentre entre 20 y 30"<<endl; return main(); }else (alumnos>=n1 && alumnos<=n2); {cout<<" "<<endl; } float notas[alumnos]={}; for(int i=0; i<=(alumnos-1);i++){ cout<<"Ingrese nota del alumno "<<(i+1)<<" "; cin>>notas[i]; //Sumar notas suma+=notas[i]; //Calcular nota máxima for(int i=0; i<=(alumnos-1);i++){ if(notas[i]>max){ max=notas[i]; alumno=(i+1); } } } //Calcular nota minima for(int i=0; i<=(alumnos-1);i++){ if(notas[i]<min){ min=notas[i]; alumno2=(i+1); } } cout<<endl<<endl; //Imprimir suma de notas cout<<"La suma de las notas de los "<<alumnos<<" alumnos es de "<<suma<<endl; //Imprimir promedio promedio=suma/alumnos; cout<<"El promedio del salon es de: "<<promedio<<endl; //Imprimir maximo cout<<"La maxima nota es de "<<max<<" y corresponde al alumno "<<alumno<<endl<<endl; cout<<"La mínima nota es de "<<min<<" y corresponde al alumno "<<alumno2<<endl<<endl; cout<<"Las notas que se encuentran dentro del promedio "<<(promedio -1)<<" y "<<(promedio+1)<<" son: "<<endl; cout<<endl; ran1=promedio-1; ran2=promedio+1; for(int i=0; i<=(alumnos-1);i++) if(notas[i]>=ran1 && notas[i]<=ran2){ cout<<endl<<"alumno"<<i+1<<" "<<"nota"<<notas[i]; } cout<<endl; cout<<"Los alumnos que obtuvieron una nota menor o igual a 6, e hicieron un trabajo para subir su calificacion 1 unidad fueron: "<<endl; cout<<"alumno cal1 cal2"<<endl; float notas2[alumnos]={}; for(int i=0; i<=(alumnos-1);i++){ if(notas[i]<=6){ notas2[i]=notas[i]+1; alumno3=(i+1); cout<<" "<<alumno3<<" "<<notas[i]<<" "<<notas2[i]<<endl; } } cout<<"Si desea regresar al programa escribe la letra R, en caso contratio escriba la letra S: R/S "<<endl; cin>>decision; if(decision=='R'|| decision=='r'){ return main(); }else{return 0; return 0; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue