Advertisement
Guest User

Untitled

a guest
Aug 18th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #[derive(Debug)]
  2. struct Rectangle {
  3. width: u32,
  4. height: u32,
  5. profundidad: u32,
  6. }
  7.  
  8. impl Rectangle {
  9. fn area(&self) -> u32 {
  10. a(&self) -> u32 {
  11. self.width * self.height * self.profundidad
  12. }
  13. }
  14.  
  15. fn main() {
  16. let rect1 = Rectangle { width: 30, height: 50, profundidad: 20 };
  17.  
  18. println!(
  19. "The area of the rectangle is {} square pixels.",
  20. rect1.area()
  21. );
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement