#include <stdio.h>
#include <locale.h>
typedef struct {
int codigo;
int tempoativo;
float potencia;
float consumonomes;
char nome[ 31 ] ;
} Equipamento;
void menu( void ) {
printf ( "---------------------------------------\n " ) ; printf ( "| Sessão de cadastro de equipamentos |\n " ) ; printf ( "---------------------------------------\n " ) ; printf ( "Digite 1 para cadastrar\n " ) ; printf ( "Digite 2 para consultar os cadastros\n " ) ; printf ( "Digite 3 para sair\n " ) ; }
void dados( Equipamento * equipamento) {
printf ( "Entre com o codigo do equipamento: " ) ; scanf ( "%d" , & equipamento
-> codigo
) ; }
int main( ) {
int resp = 0 ;
Equipamento equipamento;
do {
menu( ) ;
switch ( resp) {
case 1 :
dados( & equipamento) ;
break ;
case 2 :
break ;
}
if ( resp
> 3 || resp
< 1 ) printf ( "Valor invalido\n " ) ; } while ( resp != 3 ) ;
}
//https://pt.stackoverflow.com/q/330759/101
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxsb2NhbGUuaD4KCnR5cGVkZWYgc3RydWN0IHsKICAgIGludCBjb2RpZ287CiAgICBpbnQgdGVtcG9hdGl2bzsKICAgIGZsb2F0IHBvdGVuY2lhOwogICAgZmxvYXQgY29uc3Vtb25vbWVzOwogICAgY2hhciBub21lWzMxXTsKfSBFcXVpcGFtZW50bzsKCgp2b2lkIG1lbnUodm9pZCkgewogICAgcHJpbnRmKCItLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiIpOwogICAgcHJpbnRmKCJ8IFNlc3PDo28gZGUgY2FkYXN0cm8gZGUgZXF1aXBhbWVudG9zICB8XG4iKTsKICAgIHByaW50ZigiLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4iKTsKICAgIHByaW50ZigiRGlnaXRlIDEgcGFyYSBjYWRhc3RyYXJcbiIpOwogICAgcHJpbnRmKCJEaWdpdGUgMiBwYXJhIGNvbnN1bHRhciBvcyBjYWRhc3Ryb3Nc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