Last active
November 2, 2018 16:46
-
-
Save mesaque/41f8cb091978c5b6857a510506d898ff to your computer and use it in GitHub Desktop.
Revisions
-
mesaque revised this gist
Nov 2, 2018 . 1 changed file with 12 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,29 +1,20 @@ using System; namespace Fael { class Employee { float salarioMensal; public Employee(float salarioMensal) { this.salarioMensal = salarioMensal; } public double calcularSalarioAnual(int mesesTrabalhados) { return salarioMensal * mesesTrabalhados; @@ -37,27 +28,27 @@ namespace Fael class Program { static void Main(string[] args) { float payment; int months; Console.WriteLine("Por favor escreva o seu salario:"); payment = float.Parse( Console.ReadLine() ); Employee e = new Employee(payment); Console.WriteLine("Por favor escreva os meses trabalhados:"); months = int.Parse(Console.ReadLine()); Console.WriteLine("O salario anual é: R${0}", e.calcularSalarioAnual(months)); Console.ReadLine(); } } } -
mesaque revised this gist
Nov 2, 2018 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ using System; namespace Fael { class Employee -
mesaque revised this gist
Nov 2, 2018 . 1 changed file with 56 additions and 92 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,95 +1,59 @@ { class Employee { float salarioMensal; public Employee(float salarioMensal) { this.salarioMensal = salarioMensal; } public double calcularSalarioAnual(int mesesTrabalhados) { return salarioMensal * mesesTrabalhados; } } class Program { static void Main(string[] args) { Employee e = new Employee(1006); Console.WriteLine("O salario anual é: R${0}", e.calcularSalarioAnual(6)); Console.ReadLine(); } } } -
mesaque created this gist
Aug 19, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,95 @@ /* author:mesaque date: 08/2018 */ #include <cstdio> #include <conio.h> void menu() { printf("MENU:::"); printf("\n[1] para inserir um abastecimento:"); printf("\n[2] para ver arrecadamento:"); } struct abastecer { int litros; char tipo_combustivel; //g=gasolina, e=etanol, d=diesel float valor; }; void inserir() { float gasolina=4.89, etanol=2.68, diesel=3.78; abastecer ab; printf("\n-------------INSERIR-------------\n"); printf("quantidade de litros: "); scanf("%d", &ab.litros); printf("tipo de combustivel[g=0|e=1|d=2]: "); scanf("%d", &ab.tipo_combustivel); switch(ab.tipo_combustivel){ case 1 : ab.valor = ab.litros * etanol; break; case 2 : ab.valor = ab.litros * diesel; break; default : ab.valor = ab.litros * gasolina; break; } FILE *arquivo; if( (arquivo=fopen("abastecimento.txt", "a+")) == NULL ) { printf("nao foi possivel abrir o aquivo"); } fprintf(arquivo, "%d|%d|R$%.2f\n", ab.litros, ab.tipo_combustivel, ab.valor ); //fprintf(arquivo, "%f\n", ab.valor ); fclose(arquivo); printf("\n------INSERIDO COM SUCESSO-------\n"); } void vercaixa() { FILE * pFile; char abs [4096]; pFile = fopen ("abastecimento.txt" , "r"); if (pFile == NULL) perror ("Error opening file"); else { while ( fgets (abs , sizeof(abs), pFile) ) { puts(abs); } } fclose (pFile); } int main() { char opcao; do { menu(); opcao = getch(); switch(opcao) { case '1' : inserir(); break; case '2' : printf("\n"); vercaixa(); break; default: printf("\nopcao invalida\n"); break; } } while ( opcao != '0' ); }