Bu kod küçük bit daha sonra benim programda üzerinde, aynı hesap numarası ile iki hesap hatası (id) olmadan doğru hesabı bulabilmesi için bir metin dosyası üzerinden bakmak ve zaten yazılmış hesap numaralarını tespit için tasarlanmıştır . Ama hayır ben onun çift ters eğik çizgi, düz eğik çizgi veya lfStream nesne için bir konumda çift sağa doğru eğik çizgiler kullanılarak, ister ne yaptığım önemli; ben hep çıktı olarak dosyayı bulamıyor olsun.
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream accountsread(G:/Coding/Test/test/test/accounts.txt);
if (accountsread.is_open()) {
int tempAccno;
std::string tempname;
char tempchar;
int accountsfound = 0;
int input;
std::cout << Enter the ID of the account \n;
cin >> x;
while (!accountsread.eof()) {
accountsread >> tempAccno;
if (tempAccno == input) {
accountsfound++;
}
else {}
}
if (accountsfound > 0) {
cout << number found;
}
else {
cout << number not found;
}
}
else {
cout << cannot find file;
}
}
pencerelerde, metin dosyasının konumu G: \ \ test \ test \ test \ accounts.txt Kodlama