Docsity

Programas C++: Calculadora de Notas, Tabla de Cuadrados y Área de Triángulos, Apuntes de Programación C

Toggle sidebar
bg1
# include<iostream>
using namespace std;
int main()
{
float notas[50][12], ac = 0, n, a, mayor = 1;
cout << "Digite n estudiantes con a notas: " << endl; cin >> n >> a;
for (int f = 0; f < n; f++)
for (int c = 0; c < a; c++)
{
cin >> notas[f][c];
ac = ac + notas[f][c]; //ac+= notas[f][c]
if (notas[f][c] > mayor)
mayor = notas[f][c];
}
cout << "LA NOTA MAYOR ES: " << mayor << endl;
cout << "PROMEDIO ES: " << ac / (n * a) << endl;
for (int f = 0; f < n; f++)
{
for (int c = 0; c < a; c++)
cout << " " << notas[f][c];
cout << endl;
}
return 0;
}
#include<iostream>
int cuadrado(int); //PROTOTIPO
using namespace std;
int main()
{
int x;
for (x = 1; x <= 10; x++)
cout << "\n" << x << " " << cuadrado(x);//Llamada de la
función
system("pause");
return 0;
}
int cuadrado(int y) // estructura
{
return y * y;
}
pf2

Vista previa parcial del texto

¡Descarga Programas C++: Calculadora de Notas, Tabla de Cuadrados y Área de Triángulos y más Apuntes en PDF de Programación C solo en Docsity!

include

using namespace std; int main() { float notas[50][12], ac = 0, n, a, mayor = 1; cout << "Digite n estudiantes con a notas: " << endl; cin >> n >> a; for (int f = 0; f < n; f++) for (int c = 0; c < a; c++) { cin >> notas[f][c]; ac = ac + notas[f][c]; //ac+= notas[f][c] if (notas[f][c] > mayor) mayor = notas[f][c]; } cout << "LA NOTA MAYOR ES: " << mayor << endl; cout << "PROMEDIO ES: " << ac / (n * a) << endl; for (int f = 0; f < n; f++) { for (int c = 0; c < a; c++) cout << " " << notas[f][c]; cout << endl; } return 0; } #include int cuadrado(int); //PROTOTIPO using namespace std; int main() { int x; for (x = 1; x <= 10; x++) cout << "\n" << x << " " << cuadrado(x);//Llamada de la función system("pause"); return 0; } int cuadrado(int y) // estructura { return y * y; }

#include #include void AREA(float, float, float);// PROTOTIPO using namespace std; int main() { float L1, L2, L3; cout << "INGRESE LA MEDIDA DE LOS TRES LADOS DEL TRIANGULO" << endl; cin >> L1 >> L2 >> L3; AREA(L1, L2, L3);//Llamada de la función system("pause"); return 0; } void AREA(float X1, float X2, float X3) // ESTRUCTURA { float S, A; S = (X1 + X2 + X3) / 2; A = sqrt(S * (S - X1) * (S - X2) * (S - X3)); cout << "EL AREA DEL TRIANGULO ES " << A << endl; } #include using namespace std; float salario(int, float); //PROTOTIPO void titulo(void); //PROTOTIPO void impuesto(float); //PROTOTIPO IMP ES 10% GANANCIAS int main() { int horas; float valor, basico; titulo(); //LLAMADA A LA FUNCION cout << "Digite horas y valor por hora: " << endl; cin >> horas >> valor; cout << "El salario es: " << salario(horas, valor) << endl; //LLAMADA A LA FUNCION basico = salario(horas, valor); impuesto(basico); return 0; } void impuesto(float bas) { cout << "El impuesto es: " << bas * 0.1 << endl; } void titulo(void) //ESTRUCTURA { cout << "VIDEOJUEGOS EN 3D UMNG " << endl; cout << "====================== " << endl; } float salario(int h, float v)//ESTRUCTURA DE LA FUNCION { return h * v; } //LEER DESDE MAIN() HORAS, VALOR //CREO LA FUNCION SALARIO