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

  • SEARCH
  • Home
  • 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 8709879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:28:56+00:00 2026-06-13T04:28:56+00:00

I am new to c++. It is necessary that the input source data and

  • 0

I am new to c++. It is necessary that the input source data and output the results to implement in the main function (use operator switch).
I need to enter 10 numbers in array in case 1. How do I enter 10 numbers in array in case 1?

#include <iostream>
#include <iomanip>
#include <conio.h>

using namespace std;

class Array {
  int SIZE; //array size
  int *mass; //array name
  public: 

  Array(int = 0); 

  Array(const Array &ob); 

  void set_mass(int ,int ); 

  int get_mass(int)const; 

  void show_mass(void) const; 
  ~Array(); 
};


Array :: ~Array(){ 
  delete [] mass; 
}


Array::Array(const Array &ob):SIZE(ob.SIZE)
{
  mass = new int [SIZE];
  if(!mass) exit(1);

  for(int i=0;i<SIZE;i++) 
    mass[i]=ob.mass[i];
}

Array::Array(int N){
  if(N < 0) {cout<<"Size error!!!!\n"; return;}

  N=10;
  SIZE = N;
  mass = new int[SIZE];
  if(!mass) exit(1);

  for(int i = 0;i < SIZE; i++) {
    mass[i] = i+1;
  }
}

void Array::set_mass(int i,int x)
{ 
  mass[i] = (i >= 0 && i <SIZE) ? x :0; 
}

int Array::get_mass(int i) const
{ 
  return (i >= 0 && i < SIZE) ? mass[i] : 0; 
}

void Array::show_mass( void ) const{ 
  for(int i = 0; i < SIZE; i++)
    cout<<"["<<i<<"]="<<mass[i]<<endl;

}


int menu()   //menu
{
  cout<<"Enter: "<<endl;
  cout<<"1 - Array"<<endl;
  cout<<"2 - Show"<<endl;
  cout<<"0 - Quit"<<endl;
  int z;
  cin»z;
  return z;
}


void main()
{
  int SIZE;
  Array *mass[10];
  while (int z=menu())
  {

    switch(z)
    {

      case 1:
        {

          cout<<"Enter 10 numbers: ";

          break;
        }

      case 2:
        {
          for(int i=0;i<SIZE;i++){
            Array A1;
            A1.show_mass();
          }
          break;
        }

      default:
        {
          cout<<"Error"<<endl;
          break;
        }
    }
  }

  getch();
}
  • 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-13T04:28:57+00:00Added an answer on June 13, 2026 at 4:28 am

    I believe this is a Home work question!
    Anyways
    write a separate method

    void GetTenNumbers(int arr[]){  
        for(int counter =0; counter <10; counter ++){  
            cout<<"Enter number ";  
            cin>> arr[counter];  
        }  
    }
    

    and do something like this

    case 1: 
    {
      cout<<"Enter 10 numbers: ";
      GetTenNumbers(arr);
      break;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I add a new object item to a Main Views model that
I m new to codeigniter developement and want to know that is it necessary
Try to see which cast is faster (not necessary better): new c++ case or
if I have a input with new lines in it like: [INFO] xyz [INFO]
I have a script that makes barplots, and opens a new window when 6
I'm working on an Outlook 2010 add-in that provides a dialog for user input.
I have several php pages that have forms used to submit data. My typical
A little new to html so if further explanation is necessary or this question
Hey, I'm trying to write a program that will accept new tasks from people,
I have a list of lists that represent a grid of data (think rows

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.