Files
ed/Practica1/main.cpp

58 lines
1.2 KiB
C++
Raw Normal View History

2026-03-14 15:11:19 +01:00
#include <iostream>
#include <fstream>
2026-03-14 17:25:51 +01:00
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
2026-03-14 15:11:19 +01:00
using namespace std;
2026-03-14 17:25:51 +01:00
char getch(void){
struct termios oldt, newt;
char ch;
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
ch = getchar();
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
return ch;
}
void clear(){
ifstream archivo("/etc/os-release");
if (archivo.good()) {
system("clear");
} else {
system("cls");
}
};
2026-03-14 15:11:19 +01:00
int main()
{
2026-03-14 17:25:51 +01:00
char opcion=0;
while (opcion!='8')
{
2026-03-14 15:11:19 +01:00
cout<<"SANCIONES APP. MENU PRINCIPAL"<<endl;
cout<<"===================================="<<endl;
2026-03-14 17:25:51 +01:00
cout<<"Indroduce un numero entre 1 y 8"<<endl;
2026-03-14 15:11:19 +01:00
cout<<" 1. Consultar cehiculo."<<endl;
cout<<" 2. Añadir vehiculo."<<endl;
cout<<" 3. Mostrar radares."<<endl;
cout<<" 4. Mostrar radar."<<endl;
cout<<" 5. Procsar radar."<<endl;
cout<<" 6. Mostrar fichero de sanciones."<<endl;
cout<<" 7. Mostrar cuantia de sancion."<<endl;
cout<<" 8. Salir."<<endl;
2026-03-14 17:25:51 +01:00
cout<<"Introduce un opcion";
2026-03-14 15:11:19 +01:00
opcion=getch();
2026-03-14 17:25:51 +01:00
cout<<opcion;
clear();
};
clear();
2026-03-14 15:11:19 +01:00
return 0;
};