Total number of rows and C ++ statistical character length of the user input

#include <the iostream> 
#include <the Windows.h> 
#include < String > the using namespace STD; int main ( void ) {
     String Line;
     int COUNT = 0 ;
     int length = 0 ; 
    COUT << " Please enter any number of lines: " << endl; the while ( . 1 ) {
         // if you encounter end of file, (cin end of file is Ctrl + z), getline returns 0 IF (getline (CIN, Line)) { 
            COUNT ++

 




    
         ;
            length + = line.length (); 
        } 
        the else {
             BREAK ; 
        } 
    } 

    COUT << " you enter the total of " << << COUNT " OK " << endl; 
    COUT << "character input length: " << length << endl; 

    System ( " PAUSE " );
     return  0 ; 
}

 

Guess you like

Origin www.cnblogs.com/tanghaiyong/p/11331096.html