Advertisement
ittam

ese12

Oct 28th, 2019
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. //Dare un messaggio per dire se in una stringa sono presenti caratteri numerici#include<iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. void ins(string &s);
  6.  
  7.  
  8.  main()
  9. {
  10.     string s;
  11.     int a;
  12.     ins(s,a);
  13. }
  14.  
  15.  
  16. void ins(string &s)
  17. {
  18.     cout<<"inserisci una parola ";
  19.     cin>>s;
  20. }
  21.  
  22. void lunghezza(string s, int &a)
  23. {
  24.     a=s.length();
  25.     cout<<"la parola"<<s<<"e' composta da "<<a<<" lettere"<<endl;
  26. }
  27.  
  28. void numerici(string s, int a)
  29. {
  30.     bool t;
  31.     for(int i=0 ; i<a ; i++)
  32.     {
  33.         if(s[i] > 0 || s[i]<  9)
  34.         {
  35.             t=true;
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement