Basit bir şekilde 8 basamaklı bir şifreyi çözme kodu yazdım . Ama ekranda sürekli nane yazıyor , neden? #include <iostream> #include <windows.h> using namespace std; int main() { setlocale(LC_ALL, "turkish"); char sifre[8]; cout << "Şifreyi gir: " << endl;
for (int i = 0; i < 8; i++) { cin >> sifre[i]; } cout << endl; for (int i = 0; i < 8; i++) { if (sifre[i] < 9 && sifre[i] > 0) { for (int j = 0; j <9; j++) { if (sifre[i] == j) { cout << j << "\t"; } } } else { cout << "nane" << endl; }
} system("pause"); return 0; } |
Bildirim