English 中文(简体)
是否有任何人知道如何确定“在被点击之前预期会出现的初级抑郁症”?
原标题:Does anyone know how to fix "[Error] expected primary-expression before . token" problem?

这是我提出的法典。

#include <iostream>
#include<bits/stdc++.h>

using namespace std;

struct Account {
  string username;
  string password;
};

struct Schedule{
    char place[100];
    char time[100];
};

bool validatePassword(const string& password) {
  const regex pattern("^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$");
  return regex_match(password, pattern);
}

void createAccount() {
  Account newAccount;
  string password;

  // Get user input for username
  cout << "Enter Username: ";
  getline(cin, newAccount.username);

  do {
    // Get user input for password with validation
    cout << "Enter Password (minimum 8 characters with at least 1 number and 1 special symbol): ";
    getline(cin, password);
  } while (!validatePassword(password));

  newAccount.password = password;

  // Open file for writing account in append mode
  ofstream outfile("accounts.txt", ios::app);

  if (outfile.is_open()) {
    outfile << newAccount.username << endl;
    outfile << newAccount.password << endl;
    outfile.close();
    cout << "Account created successfully!" << endl;
  } else {
    cerr << "Error opening file for account storage!" << endl;
  }
}

void Tickets(){
    int ticket, pw;
    
    reset:
    cout << "Enter your Password: ";
    cin >> pw;
    if (pw == Account.password){
        cout << "How many tickets will you order?: ";
        cin >> ticket;
        
        cout << "Thank you for ordering!"<<endl;
    }
    else {
        cout << "Invalid Password. Try Again!" << endl;
        goto reset;
        system ("pause");
    }
}

void Book(){
    Schedule location[100] ={   
        {"San Mateo", "5:00"},
        {"Sta. Lucia", "5:30"},
        {"Santolan", "5:35"},
        {"Cubao", "4:00"},
        {"Philcoa", "4:30"},
    };
    
    for(int i = 0; i < 6; i++){
        cout << location[i].place << endl;
    }
}
int main(){
    int choice;
    
    do{
        cout << "=== MKD Bus Ticket System ===" << endl;
        cout << "1. Create Account" << endl;
        cout << "2. Order Ticket" << endl;
        cout << "3. Book Schedule" << endl;
        cout << "4. View Schedule" << endl;
        cout << "5. Display Account" << endl;
        cout << "6. EXit" << endl;
        
        cin >> choice;
        cin.ignore();
        
        switch (choice){
        case 1:
            cout << "Account Creation screen" << endl;
            createAccount ();
            break;
        case 2:
            cout << "Order Tickets" << endl;
            Tickets ();
            break;
        case 3:
            cout << "Booking" << endl;
            Book ();
            break;
        case 4:
            cout << "Schedule Viewer" << endl;
            break;
        case 5:
            cout << "Account Information" << endl;
            break;
        case 6:
            cout << "Exit" << endl;
            break;

        }
    }while (choice != 6);
}

它尚未完成,但我要指出,这是对我有利的。 第56行,预期主要表达方式之前的错误不断发生。 是否有办法解决这一问题?

我尝试在Tickets(Tickets)职能中增加新的Account,但那是徒劳的。 我预计会这样做,但并没有固定错误。

问题回答

第56行,预期主要表达方式之前的错误不断发生。 是否有办法解决这一问题?

第56条是:

    if (pw == Account.password){

<代码>Account为type,passwordinstance这一类领域。 因此,Account.password 页: 1 简言之,你要比较一下<密码>——一些现有<代码>Account的例子,但不清楚其中哪一个。 即便是<代码>createAccount(>功能,也不提供Account,在完成这一职能后仍可生存。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签