Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:03:00+00:00 2026-06-15T19:03:00+00:00

I have created an Array that is sized by user input. int spotInArray =

  • 0

I have created an Array that is sized by user input.

    int spotInArray = 0;
    Bankcard* a = NULL;
    int n;           
    cout << "Enter number of cards" << std::endl;
    cin >> n;
    a = new Bankcard[n];

This is my code I have in my switch for the user to select which card they want to delete.

            int choice;
            cout << "Enter Number of card you would like to delete: " << endl;
            cin >> choice;
                for (int i = n; i < spotInArray; i++)
                {
                    a[n] = a[n + 1];
                    a[choice - 1] = 0;
                }

I am getting this error on a[choice – 1] = 0;

IntelliSense: no operator “=” matches these operands

Here is the full code.

int main()
{
//Bankcard bankcard1("Blue Card", 1, .05, 3000.00, 430.32, 200.35, 124.00);
int spotInArray = 0;
Bankcard* a = NULL;   // Pointer to int, initialize to nothing.
int n;           // Size needed for array
cout << "Enter number of cards" << std::endl;
cin >> n;        // Read in the size
a = new Bankcard[n];  // Allocate n ints and save ptr in a.
//for (int i=0; i<n; i++) {
//a[i] = bankcard1;
//bankcard1.show();
//}



int choice;

showMenu();

cin >> choice;

while (choice != 6)
{
    switch(choice)
    {
        case 1  :   {
                    string productName;
                    int cardNum;
                    double interestRate;
                    double maxLimit;
                    double outstandingBalance;
                    double purchaseAmount;
                    double paymentAmount;
                    cout << "Enter Card Name(No spaces, no special characters)" << std::endl;
                    cin >> productName;

                    cout << "Enter Number of Card" << std::endl;
                    cin >> cardNum;

                    cout << "Enter interest Rate" << std::endl;
                    cin >> interestRate;

                    cout << "Enter Max Limit" << std::endl;
                    cin >> maxLimit;

                    cout << "Enter Outstanding Balance" << std::endl;
                    cin >> outstandingBalance;

                    cout << "Enter Purchase Amount" << std::endl;
                    cin >> purchaseAmount;

                    cout << "Enter Payment Amount" << std::endl;
                    cin >> paymentAmount;
                    Bankcard bankcard1(productName, cardNum, interestRate, maxLimit, outstandingBalance, purchaseAmount, paymentAmount);
                    a[spotInArray] = bankcard1;
                    spotInArray++;
                    break;
                    }

        case 2  :   update();
                    break;
        case 3  :   {
                        int choice;
                        cout << "Enter Number of card you would like to delete: " << endl;
                        cin >> choice;
                        for (int i = 0; i < n; i++)
                        {
                            a[n] = a[n + 1];
                            a[choice - 1] = 0;
                        }
                    }
                    deleteCard();
                    break;
        case 4  :   overLoad();
                    break;
        case 5  :   {
                        for ( int i = 0; i < spotInArray; i++)
                        {
                            cout << a[i];
                        }
                    }
                    break;
        case 6  :   exit();
                    break;

    }
    showMenu();
    cout << endl;
    cin >> choice;
};

std::cin.get();
std::cin.get();
    return 0; 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:03:01+00:00Added an answer on June 15, 2026 at 7:03 pm

    Unless there are other code that you haven’t shown, currently this for loop shouldn’t even run:

            for (int i = n; i < spotInArray; i++)
            {
                a[n] = a[n + 1];
                a[choice - 1] = 0;
            }
    

    because spotInArray is 0 and i starts at n (and you are incrementing i, too).

    Are you sure it’s failing on that line?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an array in php that prints this Array ( [mark] =>
I am currently trying to pass an array that I have created in Javascript
Explanation I have a multidimensional array that is iterated over to created a categorized
I have a form that has an array of dynamically created labels of varying
I have created a user defined type to contain some data that I will
I have created a maths library that operates via templates, it allows the user
I have created the maps api below and have an array of addresses that
I have a snippet of code that creates an array clusterUniqueMarkers that stores all
I have a 3x3 array that I'm trying to create a pointer to and
I have a config.php file that creates an array, something like $config = array(

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.