Advertisement
lollofra

Char inverter.cpp

Dec 26th, 2021 (edited)
1,300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | Software | 0 0
  1. //Char inverter.cpp: Inverte le lettere di una parola
  2. /*   * Copyright © 2017-2023 Lorenzo Fiocco <https://lorenzo.fioc.co>
  3.      * This program is free software. It comes without any warranty, to
  4.      * the extent permitted by applicable law. You can redistribute it
  5.      * and/or modify it under the terms of the Do What The F*** You Want
  6.      * To Public License, Version 2, as published by Sam Hocevar. See
  7.      * http://www.wtfpl.net/ for more details. */
  8.  
  9. #include <iostream>
  10. using namespace std;
  11.  
  12. /*  Variabili utilizzate
  13.     INPUT
  14.         parola (stringa): contiene la parola da invertire  
  15.     LAVORO
  16.         i (intero): indica il carattere da leggere nella for
  17. */
  18.  
  19. int main(){
  20.     string parola;
  21.     cout << "Inserisci parola: ";
  22.     cin >> parola;
  23.     for (unsigned int i=parola.size(); i>=0; i--)
  24.         cout << parola[i];
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement