Advertisement
any15015

Guia7_labo_Ej10

Oct 11th, 2023
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. void nombreDelDia(int dia, string nombre[], int tam);
  5.  
  6. int main(void){
  7. const int tamanio=7;
  8. int dia;
  9. string nombre[tamanio]={"Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado"};
  10. cout << "Dia nro: ";
  11. cin >> dia;
  12. nombreDelDia(dia, nombre, tamanio);
  13.  
  14.     return 0;
  15. }
  16.  
  17. void nombreDelDia(int dia, string nombre[], int tam){
  18.  
  19. if(dia<tam){
  20. cout << "Dia " << nombre[dia];
  21. }else{
  22. cout << "Valor incorrecto" << endl;
  23. }
  24.  
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement