Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void promedio() {
- float elem;
- float suma = 0;
- int n_elementos = 0;
- do {
- cin >> elem;
- if (elem != -1) {
- suma += elem;
- n_elementos++;
- }
- } while (elem != -1);
- cout << suma / n_elementos << endl;
- }
- void votacion_congreso() {
- int N, voto;
- int favor=0, contra=0, abstencion=0;
- cin >> N;
- for (int i=0; i < N; i++) {
- cout << "Emitir voto:" << endl;
- cout << "1. A favor" << endl;
- cout << "2. En contra" << endl;
- cout << "3. Abstencion" << endl;
- cin >> voto;
- switch (voto) {
- case 1:
- favor++;
- break;
- case 2:
- contra++;
- break;
- case 3:
- abstencion++;
- break;
- }
- cout << "RESULTADOS" << endl;
- cout << "A favor: " << favor << endl;
- cout << "En contra: " << contra << endl;
- cout << "Abstenciones: " << abstencion << endl;
- }
- }
- void interes() {
- float x;
- float interes = 0.005;
- cin >> x;
- for (int i = 0; i < 120; i++) {
- x =x*(1+interes);
- }
- cout << x;
- }
- void main() {
- interes();
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement