Advertisement
jtentor

TP1CEc.cpp

May 3rd, 2020
526
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. //
  2. // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
  3. //
  4. #include <iostream>
  5. #include <iomanip>
  6.  
  7. #include "Libro.h"
  8.  
  9. Libro CreaunLibro();
  10.  
  11.  
  12. int main() {
  13.     std::cout << "Clase Libro" << std::endl;
  14.  
  15.     Libro unlibro = CreaunLibro();
  16.  
  17.     std::cout << unlibro;
  18.  
  19.     return 0;
  20. }
  21.  
  22. Libro CreaunLibro() {
  23.     std::string titulo;
  24.     std::string autor;
  25.     std::string editorial;
  26.     int anio;
  27.     float precio;
  28.     std::string buffer;
  29.  
  30.     std::cout << "Ingrese el Titulo...: ";
  31.     std::getline(std::cin, titulo);
  32.  
  33.     std::cout << "Ingrese el Autor....: ";
  34.     std::getline(std::cin, autor);
  35.  
  36.     std::cout << "Ingrese el Editorial: ";
  37.     std::getline(std::cin, editorial);
  38.  
  39.     std::cout << "Ingrese el AƱo......: ";
  40.     std::getline(std::cin, buffer);
  41.     anio = std::stoi(buffer);
  42.  
  43.     std::cout << "Ingrese el Precio...: ";
  44.     std::getline(std::cin, buffer);
  45.     precio  = std::stof(buffer);
  46.  
  47.     Libro libro = Libro(titulo, autor, editorial, anio, precio);
  48.     return libro;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement