hola tengo problemas con un codigo yo lo tengo de una forma pero mi profesor me dice que hay otra forma de hacerlo y mas corto pero no encuentro la forma y tambien tengo problemas tengo que multiplicar la tercer columna y dividirla por el numero que sale hasa abajo y dice resultado de la suma solo que no puedo me sale a la hora de ejecutarlo me sale solo (inf).
dejo mi codigo lo estoy corriendo en dev c++
espero puedan ayudarme llevo 2 dias tratando de hacerlo
#include <stdlib.h>
#include <time.h>
#include<iostream>
using namespace std;
int main()
{
int num, c, a, b, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a1, b2, c3, d4,e5,e6,e7,e8,e9,b1,b3,b4,b5,b6,b7,b8,b9,c1,c2,c4,c5,c6,c7,c8,c9,l1,l2,l3,l4,l5,l6,l7,l8,l9,x2,suma;
srand(time(NULL));
for(c = 1; c <= 1; c++)
{
num = 1 + rand() % (80 - 1);
e5=80+3;
cout << 80<< " \t+3 \t ";
cout << e5<< " \t";
cout << 83<< " \t";
cout << 83*100<< " \n\n";
}
for(c = 1; c <= 1; c++)
{
a = 1 + rand() % (80 - 1);
e6=a+3;
cout << a<< " \t+3 \t ";
cout << e6<< " \t";
cout << e5+e6<< " \t";
cout << e6*100<< " \n\n";
}
{
b = 1 + rand() % (80 - 1);
e7=b+3;
cout << b<< " \t+3 \t ";
cout << e7<<" \t";
cout << e5+e6+e7<< " \t";
cout << e7*100<< " \n\n";
}
{
d = 1 + rand() % (80 - 1);
e8=d+3;
cout << d<< " \t+3 \t ";
cout << e8<<" \t";
cout << e5+e6+e7+e8<< " \t";
cout << e8*100<< " \n\n";
}
{
e = 1 + rand() % (80 - 1);
e9=e+3;
cout << e<< " \t+3 \t ";
cout << e9<<" \t";
cout << e5+e6+e7+e8+e9<< " \t";
cout << e9*100<< " \n\n";
}
{
f = 1 + rand() % (80 - 1);
b1=f+3;
cout << f<< " \t+3 \t ";
cout << b1<<" \t";
cout << e5+e6+e7+e8+e9+b1<< " \t";
cout << b1*100<< " \n\n";
}
{
g = 1 + rand() % (80 - 1);
b3=g+3;
cout << g<< " \t+3 \t ";
cout << b3<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3<< " \t";
cout << b3*100<< " \n\n";
}
{
h = 1 + rand() % (80 - 1);
b4=h+3;
cout << h<< " \t+3 \t ";
cout << b4<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4<< " \t";
cout << b4*100<< " \n\n";
}
{
i = 1 + rand() % (80 - 1);
b5=i+3;
cout << i<< " \t+3 \t ";
cout << b5<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5<< " \t";
cout << b5*100<< " \n\n";
}
{
j = 1 + rand() % (80 - 1);
b6=4;
cout << 1<< " \t+3 \t ";
cout << b6<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6<< " \t";
cout << b6*100<< " \n\n";
}
{
k = 1 + rand() % (80 - 1);
b7=k+3;
cout << k<< " \t+3 \t ";
cout << b7<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7<< " \t";
cout << b7*100<< " \n\n";
}
{
l = 1 + rand() % (80 - 1);
b8=l+3;
cout << l<< " \t+3 \t ";
cout << b8<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8<< " \t";
cout << b8*100<< " \n\n";
}
{
m = 1 + rand() % (80 - 1);
b9=m+3;
cout << m<< " \t+3 \t ";
cout << b9<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9<< " \t";
cout << b9*100<< " \n\n";
}
{
n = 1 + rand() % (80 - 1);
c1=n+3;
cout << n<< " \t+3 \t ";
cout << c1<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1<< " \t";
cout << c1*100<< " \n\n";
}
{
o = 1 + rand() % (80 - 1);
c2=o+3;
cout << o<< " \t+3 \t ";
cout << c2<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2<< " \t";
cout << c2*100<< " \n\n";
}
{
p = 1 + rand() % (80 - 1);
c4=p+3;
cout << p<< " \t+3 \t ";
cout << c4<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4<< " \t";
cout << c4*100<< " \n\n";
}
{
q = 1 + rand() % (80 - 1);
c5=q+3;
cout << q<< " \t+3 \t ";
cout << c5<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5<< " \t";
cout << c5*100<< " \n\n";
}
{
r = 1 + rand() % (80 - 1);
c6=r+3;
cout << r<< " \t+3 \t ";
cout << c6<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6<< " \t";
cout << c6*100<< " \n\n";
}
{
s = 1 + rand() % (80 - 1);
c7=s+3;
cout << s<< " \t+3 \t ";
cout << c7<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7<< " \t";
cout << c7*100<< " \n\n";
}
{
t = 1 + rand() % (80 - 1);
c8=t+3;
cout << t<< " \t+3 \t ";
cout << c8<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8<< " \t";
cout << c8*100<< " \n\n";
}
{
u = 1 + rand() % (80 - 1);
c9=u+3;
cout << u<< " \t+3 \t ";
cout << c9<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9<< " \t";
cout << c9*100<< " \n\n";
}
{
v = 1 + rand() % (80 - 1);
l1=v+3;
cout << v<< " \t+3 \t ";
cout << l1<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1<< " \t";
cout << l1*100<< " \n\n";
}
{
w = 1 + rand() % (80 - 1);
l2=w+3;
cout << w<< " \t+3 \t ";
cout << l2<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2<< " \t";
cout << l2*100<< " \n\n";
}
{
x = 1 + rand() % (80 - 1);
l3=x+3;
cout << x<< " \t+3 \t ";
cout << l3<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3<< " \t";
cout << l3*100<< " \n\n";
}
{
y = 1 + rand() % (80 - 1);
l4=y+3;
cout << y<< " \t+3 \t ";
cout << l4<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4<< " \t";
cout << l4*100<< " \n\n";
}
{
z = 1 + rand() % (80 - 1);
l5=z+3;
cout << z<< " \t+3 \t ";
cout << l5<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5<< " \t";
cout << l5*100<< " \n\n";
}
{
a1 = 1 + rand() % (80 - 1);
l6=a1+3;
cout << a1<< " \t+3 \t ";
cout << l6<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6<< " \t";
cout << l6*100<< " \n\n";
}
{
b2 = 1 + rand() % (80 - 1);
l7=b2+3;
cout << b2<< " \t+3 \t ";
cout << l7<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7<< " \t";
cout << l7*100<< " \n\n";
}
{
c3 = 1 + rand() % (80 - 1);
l8=c3+3;
cout << c3<< " \t+3 \t ";
cout << l8<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8<< " \t";
cout << l8*100<< " \n\n";
}
{
d4 = 1 + rand() % (80 - 1);
l9=d4+3;
cout << d4<< " \t+3 \t ";
cout << l9<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8+l9<< " \t";
cout << l9*100<< " \t";
cout << l9/x2<< " \n\n";
}
{
x2=e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8+l9;
cout << suma<< "resultado suma\t ";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8+l9<< " \n\n";
}
{
printf("el valor maximo es 83 y el minimo 4");
}
return 0;
}
dejo mi codigo lo estoy corriendo en dev c++
espero puedan ayudarme llevo 2 dias tratando de hacerlo
#include <stdlib.h>
#include <time.h>
#include<iostream>
using namespace std;
int main()
{
int num, c, a, b, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a1, b2, c3, d4,e5,e6,e7,e8,e9,b1,b3,b4,b5,b6,b7,b8,b9,c1,c2,c4,c5,c6,c7,c8,c9,l1,l2,l3,l4,l5,l6,l7,l8,l9,x2,suma;
srand(time(NULL));
for(c = 1; c <= 1; c++)
{
num = 1 + rand() % (80 - 1);
e5=80+3;
cout << 80<< " \t+3 \t ";
cout << e5<< " \t";
cout << 83<< " \t";
cout << 83*100<< " \n\n";
}
for(c = 1; c <= 1; c++)
{
a = 1 + rand() % (80 - 1);
e6=a+3;
cout << a<< " \t+3 \t ";
cout << e6<< " \t";
cout << e5+e6<< " \t";
cout << e6*100<< " \n\n";
}
{
b = 1 + rand() % (80 - 1);
e7=b+3;
cout << b<< " \t+3 \t ";
cout << e7<<" \t";
cout << e5+e6+e7<< " \t";
cout << e7*100<< " \n\n";
}
{
d = 1 + rand() % (80 - 1);
e8=d+3;
cout << d<< " \t+3 \t ";
cout << e8<<" \t";
cout << e5+e6+e7+e8<< " \t";
cout << e8*100<< " \n\n";
}
{
e = 1 + rand() % (80 - 1);
e9=e+3;
cout << e<< " \t+3 \t ";
cout << e9<<" \t";
cout << e5+e6+e7+e8+e9<< " \t";
cout << e9*100<< " \n\n";
}
{
f = 1 + rand() % (80 - 1);
b1=f+3;
cout << f<< " \t+3 \t ";
cout << b1<<" \t";
cout << e5+e6+e7+e8+e9+b1<< " \t";
cout << b1*100<< " \n\n";
}
{
g = 1 + rand() % (80 - 1);
b3=g+3;
cout << g<< " \t+3 \t ";
cout << b3<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3<< " \t";
cout << b3*100<< " \n\n";
}
{
h = 1 + rand() % (80 - 1);
b4=h+3;
cout << h<< " \t+3 \t ";
cout << b4<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4<< " \t";
cout << b4*100<< " \n\n";
}
{
i = 1 + rand() % (80 - 1);
b5=i+3;
cout << i<< " \t+3 \t ";
cout << b5<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5<< " \t";
cout << b5*100<< " \n\n";
}
{
j = 1 + rand() % (80 - 1);
b6=4;
cout << 1<< " \t+3 \t ";
cout << b6<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6<< " \t";
cout << b6*100<< " \n\n";
}
{
k = 1 + rand() % (80 - 1);
b7=k+3;
cout << k<< " \t+3 \t ";
cout << b7<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7<< " \t";
cout << b7*100<< " \n\n";
}
{
l = 1 + rand() % (80 - 1);
b8=l+3;
cout << l<< " \t+3 \t ";
cout << b8<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8<< " \t";
cout << b8*100<< " \n\n";
}
{
m = 1 + rand() % (80 - 1);
b9=m+3;
cout << m<< " \t+3 \t ";
cout << b9<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9<< " \t";
cout << b9*100<< " \n\n";
}
{
n = 1 + rand() % (80 - 1);
c1=n+3;
cout << n<< " \t+3 \t ";
cout << c1<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1<< " \t";
cout << c1*100<< " \n\n";
}
{
o = 1 + rand() % (80 - 1);
c2=o+3;
cout << o<< " \t+3 \t ";
cout << c2<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2<< " \t";
cout << c2*100<< " \n\n";
}
{
p = 1 + rand() % (80 - 1);
c4=p+3;
cout << p<< " \t+3 \t ";
cout << c4<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4<< " \t";
cout << c4*100<< " \n\n";
}
{
q = 1 + rand() % (80 - 1);
c5=q+3;
cout << q<< " \t+3 \t ";
cout << c5<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5<< " \t";
cout << c5*100<< " \n\n";
}
{
r = 1 + rand() % (80 - 1);
c6=r+3;
cout << r<< " \t+3 \t ";
cout << c6<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6<< " \t";
cout << c6*100<< " \n\n";
}
{
s = 1 + rand() % (80 - 1);
c7=s+3;
cout << s<< " \t+3 \t ";
cout << c7<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7<< " \t";
cout << c7*100<< " \n\n";
}
{
t = 1 + rand() % (80 - 1);
c8=t+3;
cout << t<< " \t+3 \t ";
cout << c8<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8<< " \t";
cout << c8*100<< " \n\n";
}
{
u = 1 + rand() % (80 - 1);
c9=u+3;
cout << u<< " \t+3 \t ";
cout << c9<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9<< " \t";
cout << c9*100<< " \n\n";
}
{
v = 1 + rand() % (80 - 1);
l1=v+3;
cout << v<< " \t+3 \t ";
cout << l1<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1<< " \t";
cout << l1*100<< " \n\n";
}
{
w = 1 + rand() % (80 - 1);
l2=w+3;
cout << w<< " \t+3 \t ";
cout << l2<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2<< " \t";
cout << l2*100<< " \n\n";
}
{
x = 1 + rand() % (80 - 1);
l3=x+3;
cout << x<< " \t+3 \t ";
cout << l3<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3<< " \t";
cout << l3*100<< " \n\n";
}
{
y = 1 + rand() % (80 - 1);
l4=y+3;
cout << y<< " \t+3 \t ";
cout << l4<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4<< " \t";
cout << l4*100<< " \n\n";
}
{
z = 1 + rand() % (80 - 1);
l5=z+3;
cout << z<< " \t+3 \t ";
cout << l5<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5<< " \t";
cout << l5*100<< " \n\n";
}
{
a1 = 1 + rand() % (80 - 1);
l6=a1+3;
cout << a1<< " \t+3 \t ";
cout << l6<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6<< " \t";
cout << l6*100<< " \n\n";
}
{
b2 = 1 + rand() % (80 - 1);
l7=b2+3;
cout << b2<< " \t+3 \t ";
cout << l7<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7<< " \t";
cout << l7*100<< " \n\n";
}
{
c3 = 1 + rand() % (80 - 1);
l8=c3+3;
cout << c3<< " \t+3 \t ";
cout << l8<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8<< " \t";
cout << l8*100<< " \n\n";
}
{
d4 = 1 + rand() % (80 - 1);
l9=d4+3;
cout << d4<< " \t+3 \t ";
cout << l9<<" \t";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8+l9<< " \t";
cout << l9*100<< " \t";
cout << l9/x2<< " \n\n";
}
{
x2=e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8+l9;
cout << suma<< "resultado suma\t ";
cout << e5+e6+e7+e8+e9+b1+b3+b4+b5+b6+b7+b8+b9+c1+c2+c4+c5+c6+c7+c8+c9+l1+l2+l3+l4+l5+l6+l7+l8+l9<< " \n\n";
}
{
printf("el valor maximo es 83 y el minimo 4");
}
return 0;
}