15. Berilgan matnli fayldan simvollarni o‘qib, ekranga chiqaring va raqamlarni ajratib ko‘rsating


Download 34.36 Kb.
Sana15.06.2023
Hajmi34.36 Kb.
#1479445
Bog'liq
ALGARITM


TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITETI KIBER XAVFSIZLIK FAKULTETI 713-21-GURUH TALABASI TEMIROVAMIRXONNING MA’LUMOTLAR TUZILMASI VA ALGARITMLAR FANIDAN 1-TOPSHIRIQI

2022
15.Berilgan matnli fayldan simvollarni o‘qib, ekranga chiqaring va raqamlarni ajratib ko‘rsating.


#include
#include
#include
#include


using namespace std;


int main()
{
ifstream inputFile;
string fileName;
char c;
int nNum = 0;
cout << "Enter the file name: ";
getline(cin, fileName);


// Open the file
inputFile.open(fileName.c_str());


// Check for successful opening
if(inputFile.fail())
{
cerr << "Error Opening File" << endl;
return(1);
}
while(!inputFile.eof())
{
inputFile.get(c);
if (c == 'a' || c == 'e' || c == 'o' || c == 'i' || c == 'u')
nNum++;
}
inputFile.close();
cout << nNum;
return 0;
}

Download 34.36 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling