Created
October 27, 2017 21:59
-
-
Save jesuscmadrigal/91e7e9abd05792e03aa4cb12a903f17c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
struct datos | |
{ | |
int l,c; | |
}; | |
datos func(string ruta, datos& there) | |
{ | |
ifstream archivo(ruta.c_str(), ios:: in); | |
char car; | |
string theline; | |
while(getline(archivo, theline)) | |
{ | |
there.l++; | |
there.c = there.c + theline.length(); | |
} | |
return there; | |
} | |
int main() | |
{ | |
datos here; | |
string url; | |
cout<< "Enter the file URL: "<< endl; | |
cin>> url; | |
func(url, here); | |
cout << "Number of lines: "<< here.l << endl; | |
cout << "Number of characteres: " << here.c << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment