Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. //============================================================================
  2. // Name        : UsaVettore.cpp
  3. // Author      : Vincenzo
  4. // Version     :
  5. // Copyright   : All rights reserved.
  6. // Description : Finding a single character occurrences in a characters'vector (string)
  7. //============================================================================
  8.  
  9. #include <iostream>
  10. #include "Vettore.h"
  11.  
  12.  
  13. using namespace std;
  14.  
  15.  
  16. int main()
  17. {
  18.     string frase = ""; //frase inizializzata con stringa nulla
  19.     char ast = '\0'; //ast inizializata al carattere nullo
  20.  
  21.     cout << "Inserire frase:" << endl;
  22.     leggiFrase(frase); //procedura per la lettura da tastiera della frase
  23.  
  24.     cout << "Inserire carattere da ricercare: " << endl;
  25.     leggiAst(ast); //procedura per la lettura da tastiera del carattere
  26.  
  27.     int numOccorrenze = RicercaInFrase(frase, ast); //restituisce il numero di occorrenze di AST
  28.     cout << "Occorrenze di " << ast << ": " << numOccorrenze << endl; //stampa il numero di occorrenze
  29.  
  30.     return 0; //restituisci al sistema operativo il valore 0 per indicare che il programma si è concluso con successo
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement