Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2012
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. /*---------------------------------------------------------*/
  2. /* Search */
  3. /* */
  4. /* This program searches an array made from a data file for characters */
  5. /* */
  6. /* */
  7.  
  8. #include <iostream>
  9. #include <fstream>
  10. #include <string>
  11. #include <Windows.h>
  12. using namespace std;
  13.  
  14. void main ()
  15. {
  16. string string;
  17. double x;
  18. int cha[i];
  19. int count;
  20. ifstream myfile;
  21. myfile.open ("char2.txt");
  22. if (myfile.is_open())
  23.  
  24. while(!myfile.eof())
  25.  
  26. getline(myfile,string);
  27.  
  28. if( ! myfile.fail () ) cout << "there's something wrong with the file!\n";
  29.  
  30. for(count = 0; count < i; count++) if( !(myfile >> cha[i]) ) break;
  31.  
  32.  
  33. cout << "Pick a letter betweent 'a' and 'z' to search for \n";
  34. cin >> "x"
  35. int flag = 0;
  36. for (int i = 0, i < 13, i++);
  37. if ( x == cha[i])
  38.  
  39. cout << "Letter found." << endl;
  40.  
  41. else
  42.  
  43. cout << "Letter not found." << endl;
  44.  
  45.  
  46.  
  47.  
  48. myfile.close();
  49. Sleep (20000);
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement