Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

파일 입출력 1

From ZeroWiki
Revision as of 05:31, 7 February 2021 by imported>Unknown
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
#include <iostream> 
#include <fstream> 
#include <string> 

using namespace std; 

int main() 
{ 
    ifstream fin; 
    fin.open("score3.txt"); 
    string temp; 
    int i=0; 
    float num; 
//    string AP = "A+"; 
    while(fin >> temp) 
    { 
//        cout << temp; 
        i++; 
        if(i==10) 
        { 
            num = atof(temp.c_str()); 
            cout << num; 
        //    if(AP==temp) 
        //        cout << "에이 뿔이다."<<endl; 

        } 
        if(i==11) 
        { 
            cout << endl; 
            i=1; 
        } 
    } 
        fin.close(); 
    return 0; 
     
}