مشکل این کد با پسورد - هفت خط کد انجمن پرسش و پاسخ برنامه نویسی

مشکل این کد با پسورد

0 امتیاز

مشکل کد زیر چی هست ؟ من حتی وقتی که یوزنیم صحیح را وارد می کنم باز هم یوزر نیم از من میخواد !!

#include <iostream>
#include <stdio.h>
#include <string>
#include <fstream>

using namespace std;
void menu(int argc, const char * argv[], char text[2000]);

string encryptDecrypt(string toEncrypt) {
    char key = 'K'; //Any char will work
    string output = toEncrypt;

    for (int i = 0; i < toEncrypt.size(); i++)
        output[i] = toEncrypt[i] ^ key;

    return output;
}

void menu(int argc, const char * argv[], char text[2000])
{

    system("color 0A");
    //ifstream my_input_file;
    ofstream my_output_file;

    my_output_file.open("output_data.txt");

    cout<<"Please enter your text: ";
    //cin>>text;
    //cin.ignore();
    //cin.getline(text, sizeof text);
    cin.getline(text,2000);
    //cout<<"You entered: "<< text <<"\n";

    //string encrypted = encryptDecrypt("kylewbanks.com");
    string encrypted = encryptDecrypt(text);
    cout << "Encrypted:" << encrypted << "\n";

    string decrypted = encryptDecrypt(encrypted);
    cout << "Decrypted:" << decrypted << "\n";

    my_output_file << "Your encrypted text is: "  << encrypted;
    my_output_file.close();
    cin.get();
}

int main()
{
    string username;
    string password;
do {
  std::cout << "username: ";
  getline(std::cin, username);
     if (username == "John") {
        std::cout << "password: ";
        getline(std::cin, password);
    if (password != "cherry") {
      std::cout << "invalid password. try again." << std::endl;
    }
    else if (password == "cherry"){
         void menu(int argc, const char * argv[], char text[2000]);
    }
    }
    else {
        std::cout << "invalid username. try again." << std::endl;
    }
} while (password != "1234");   
    return 1;   
}

 

سوال شده شهریور 4, 1393  بوسیله ی sean (امتیاز 9)   1
خب این چیه نوشتی ؟
void menu(int argc, const char * argv[], char text[2000]);

یعنی چی آخه !؟

پاسخ شما

اسم شما برای نمایش (دلخواه):
از ایمیل شما فقط برای ارسال اطلاعات بالا استفاده میشود.
تایید نامه ضد اسپم:

برای جلوگیری از این تایید در آینده, لطفا وارد شده یا ثبت نام کنید.
...