Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #define mf i=0;i<5;i++
- typedef struct cores{
- int a;
- int b;
- int c;
- int d;
- }cor;
- int main(){
- float tol[12] = {0,1,2,0,0,0.5,0.25,0.1,0.05,0,5,10};
- char zer[][30] = {"0","00","x10³","x10⁴","x10⁵",
- "x10⁶","x10⁷","x10⁸","x10⁹"};
- cor c[5];
- int i=0,k=1;
- for(mf){
- printf("Menu de cores:\n 0 - Preto\n 1 - Marrom\n 2 - Vermelho\n 3 - Laranja\n 4 - Amarelo\n 5 - Verde\n 6 - Azul\n 7 - Violeta\n 8 - Cinza\n 9 - Branco\n TOLERANCIA:\n 10 - Dourado\n 11 - Prata\n\n ");
- printf("Resistor %d: \n",i+1);
- printf("cor1: ");
- scanf("%d",&c[i].a);
- printf("cor2: ");
- scanf("%d",&c[i].b);
- printf("cor3: ");
- scanf("%d",&c[i].c);
- printf("cor4: ");
- scanf("%d",&c[i].d);
- printf("\n-----------------------\n");
- }
- system("clear");
- printf("Valores:\n");
- for(mf){
- printf("\nResistor %d: %d%d%s",i+1,c[i].a,c[i].b,zer[(c[i].c)-1]);
- printf("ohms com %g de tolerancia. \n",tol[c[i].d]);
- printf("\n------------------------\n");
- }
- //system("PAUSE"); //para funcionar no windows só apagar o getchar e descomentar essa linha
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement