SHARE
TWEET

3.4

a guest Nov 11th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cstring>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6. int main() {
  7.     ifstream f("nigg1a.txt");
  8.     if (!f) cout << "file not open\n"; else cout << "file open\n";
  9.     char*str= new char;
  10.       char*std= new char;
  11.     int x,n,d;
  12.     int c=0;
  13.     while (!f.eof()) {f>>str; n=n+1;}
  14. cout<<"str=" << str<<endl;
  15.     d=strlen(str);
  16.     cout<< "d="<<d<<endl;
  17.     for (x=0;x!=d;x++){
  18. if (isdigit(str[x])){std[x]=str[x];c=c+1;}
  19.     }
  20.     cout<<"digit is:";
  21.     for (x=0;x!=c;x++){
  22.         cout << std[x];
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top