Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*---------------------------------------------------------*/
- /* Search */
- /* */
- /* This program searches an array made from a data file for characters */
- /* */
- /* */
- #include <iostream>
- #include <fstream>
- #include <string>
- #include <Windows.h>
- using namespace std;
- void main ()
- {
- string string;
- double x;
- int cha[i];
- int count;
- ifstream myfile;
- myfile.open ("char2.txt");
- if (myfile.is_open())
- while(!myfile.eof())
- getline(myfile,string);
- if( ! myfile.fail () ) cout << "there's something wrong with the file!\n";
- for(count = 0; count < i; count++) if( !(myfile >> cha[i]) ) break;
- cout << "Pick a letter betweent 'a' and 'z' to search for \n";
- cin >> "x"
- int flag = 0;
- for (int i = 0, i < 13, i++);
- if ( x == cha[i])
- cout << "Letter found." << endl;
- else
- cout << "Letter not found." << endl;
- myfile.close();
- Sleep (20000);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement