No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
#include <fstream> #include <cctype> #include <iostream> #include <string> const int num=1024; using namespace std; int main(){ ifstream file; string s; int i=0; file.open("words1.txt"); while(getline(file,s)){ for(int i=0; i< s.length(); i++){ cout << s[i];//prints out the text file just fine. "a dog." cout << s[0]; /*prints out random stuff. <---my problem. All … |
|
#include <iostream> #include <fstream> #include <string> #include <cctype> using namespace std; const int num=1000; int main(int argc, char *argv[]){ if (argc == 2){ ifstream file; file.open(argv[1]); } else cout << "You typed only one file" << endl; ifstream file; file.open(argv[1]); string space; char word; int i=0; int w=0; int s=0; … |