Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <stdio.h>
- #include <iostream>
- using namespace System;
- using namespace std;
- void input(int *consumo, char *tipo)
- {
- *consumo = 0;
- while (*consumo < 100)
- {
- cout << "Ingrese la cantidad de KWH consumidos: ";
- cin >> *consumo;
- if (*consumo < 100)
- cout << "Cantidad de consumo minima NO superada!! (100 KWH)" << endl;
- }
- cout << "Ingrese el tipo de consumidor, ";
- Console::ForegroundColor = ConsoleColor::DarkYellow;
- cout << "p";
- Console::ForegroundColor = ConsoleColor::Gray;
- cout << "articular o ";
- Console::ForegroundColor = ConsoleColor::DarkYellow;
- cout << "c";
- Console::ForegroundColor = ConsoleColor::Gray;
- cout << "omercial: ";
- cin >> *tipo;
- }
- void calc(int *con, char *tipo, float *total)
- {
- switch (*tipo)
- {
- case 'p':
- case 'P':
- *total = *con * 1.58;
- break;
- case 'c':
- case 'C':
- for (int i = 0; i <= 100 || i <= *con; i++)
- {
- *total += 0.35;
- }
- for (int i = 100; i <= 500 || i <= *con; i++)
- {
- *total += 1.05;
- }
- for (int i = 500; i == *con; i++)
- {
- *total += 1.36;
- }
- default:
- cout << "ERROR";
- _getch();
- exit(0);
- break;
- }
- }
- int main()
- {
- int *consumo;
- char *tipo;
- float *precio;
- tipo = new char;
- consumo = new int;
- precio = new float;
- input(consumo, tipo);
- calc(consumo, tipo, precio);
- delete precio, consumo, tipo;
- _getch();
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement