gms93
(usa Ubuntu)
Enviado em 02/10/2016 - 15:36h
Minha estrutura while não usa cada um.dos.elementos do.vetor rm e rt para calcular aij
pq meu while nao funciona para cada rm[NP-1] e rt[NP-1]]?
OBS: minha indentação é muito ruim, desculpa!
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main ()
{
float Rd;
float Rt;
float Lp;
float d;
float md;
float mt;
float mb;
float Mq;
float roh;
float nd;
float nt;
int NC;
int NP;
printf("Digite o raio dianteiro(Rd): ");
scanf("%f", &Rd);
printf("Insira o raio traseiro(Rt): ");
scanf("%f", &Rt);
printf("Insira o comprimento do pedivela(Lp): ");
scanf("%f", &Lp);
printf("Insira a distancia entre eixos(d): ");
scanf("%f", &d);
printf("Insira a massa do conjunto aro-camara-pneu dianteiro(md): ");
scanf("%f", &md);
printf("Insira a massa do conjunto aro-camara-pneu traseiro(mt): ");
scanf("%f", &mt);
printf("Insira a massa do bloco de transmissao(mb): ");
scanf("%f", &mb);
printf("Insira a massa quadro(Mq): ");
scanf("%f", &Mq);
printf("Insira a densidade das hastes(roh): ");
scanf("%f", &roh);
printf("Insira o numero de hastes da roda dianteira(nd): ");
scanf("%f", &nd);
printf("Insira o numero de hastes da roda traseira(nt): ");
scanf("%f", &nt);
printf("Insira o numero de coroas: ");
scanf("%i", &NC);
printf("Insira o numero de pinhoes ");
scanf("%i", &NP);
printf("Conferencia de dados\n Rd=%.3f\n Rt=%.3f\n Lp=%.3f\n d=%.3f\n md=%.3f\n mt=%.3f\n mb=%.3f\n Mq=%.3f\n roh=%.3f\n nd=%.3f\n nt=%.3f\n NC=%i\n NP=%i\n", Rd, Rt, Lp, d, md, mt, mb, Mq, roh, nd, nt, NC, NP);
printf("\n");
int i;
float *rm;
rm= calloc(sizeof(float),NC);
for(i=0; i<NC; i++)
{
printf("Digite o raio da coroa: ");
scanf("%f", &rm[i]);
}
printf("\n");
for(i=0; i<NC; i++)
{
printf("rm[%d] = %.3f\n", i, rm[i]);
}
printf("\n");
int j;
float *rt;
rt= calloc(sizeof(float),NP);
for(j=0; j<NP; j++)
{
printf("Digite o raio do pinhao: ");
scanf("%f", &rt[j]);
}
printf("\n");
for(j=0; j<NP; j++)
{
printf("rt[%d] = %.3f\n", j, rt[j]);
}
printf("\n");
int w, NCOMP, soma=0;
float MEDG;
printf("Digite o numero de integrantes: ");
scanf("%i", &NCOMP);
float *Mgrp;
Mgrp= calloc(sizeof(float),NCOMP);
for(w=0; w<NCOMP; w++)
{
printf("Digite o peso do integrante do grupo: ");
scanf("%f", &Mgrp[w]);
}
printf("\n");
for(w=0; w<NCOMP; w++)
{
printf("Mgrp[%d] = %.3f\n", w, Mgrp[w]);
}
for(w=1; w<=NCOMP; w++)
soma=soma+Mgrp[w];
printf("\n");
MEDG = soma / NCOMP;
printf("A media das massas dos integrante e(MEDG): \n %.3f\n", MEDG);
printf("\n");
float Mc[5] = {0.6*MEDG,0.8*MEDG,MEDG,1.2*MEDG,1.4*MEDG};
printf("As massas do ciclista sao:\n Mc1=%.1f\n Mc2=%.1f\n Mc3=%.1f\n Mc4=%.1f\n Mc5=%.1f\n", Mc[0], Mc[1], Mc[2], Mc[3], Mc[4]);
float g = 9.81;
float Fm[4] = {0.1*MEDG,0.2*MEDG,0.3*MEDG,0.4*MEDG};
printf("As forcas motrizes sao:\n Fm1=%.1f\n Fm2=%.1f\n Fm3=%.1f\n Fm4=%.1f\n ", Fm[0], Fm[1], Fm[2], Fm[3]);
printf("\n");
float Md = (md + (nd*roh*Rd));
printf("A massa da roda dianteira e :\n %.3f", Md);
printf("\n");
float Id = (md*pow(Rd, 2))+(nd*((roh*pow(Rd, 3)))/3)+(Md*pow(Rd, 2));
printf("\n");
printf("Momento de inercia da roda dianteira e :\n %.3f", Id);
printf("\n");
float Mt = mt+(nt*roh*Rt)+mb;
printf("A massa da roda traseira e :\n %.3f", Mt);
printf("\n");
float Ib = 0.3*((pow(rt[NP-1], 5))-(pow(rt[1], 5))/(pow(rt[NP-1], 3)-(pow(rt[1], 3))))*mb;
printf("Momento de incercia do bloco (Ib) e: \n %.3f", Ib);
printf("\n");
float It = (mt*pow(Rt, 2))+(nt*((roh*pow(Rt, 3))/3))+Ib+(Mt*pow(Rt, 2));
printf("O momento de inercia total(It) e: \n %.3f", It);
printf("\n");
int o =0;
while(o<NC)
{
int p =0;
while(p<NP){
float tetamin= asin((rm[p]-rt[o])/d);
printf("o e: \n %i", o);
printf("\n");
printf("rm[%d] = %.3f\n", o, rm[o]);
printf("\n");
printf("p e: \n %i", p);
printf("\n");
printf("rt[%d] = %.3f\n", p, rt[p]);
printf("\n");
printf("rt[j]/rm[i] = %.3f\n", rt[p]/rm[o]);
printf("\n");
int k;
k=0;
while(k<5){
printf("Mc[k] = %.3f\n", k, Mc[k]);
float y= 1+((Mq+Mc[k])*pow(Rd, 2)/Id);
int l;
l=0;
while(l<4) {
float aij = ((Rt*pow(Rd,2))/(pow(Rt,2)*Id*y+pow(Rd,2)*It))*rt[p]*((Fm[l]*Lp)/rm[o])*(1+(2*Rt)/rt[p]*(pow((M_PI-2*tetamin),2)))*(2*cos(tetamin)-(M_PI-(2*tetamin)*sin(tetamin)));
printf("Fm[l] = %.3f\n", Fm[l]);
printf("aij : %.3f\n", aij);
l=l+1;
break;}
k= k+1;
break;}
p= p+1;
break;}
o= o+1;
break;}
return 0;
}