Advertisement
Guest User

3.4

a guest
Nov 11th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement