I get the following error when compiling my program. error C2440: \'=\' : cannot
ID: 3649126 • Letter: I
Question
I get the following error when compiling my program.error C2440: '=' : cannot convert from 'int [50]' to 'int'
The assignment asks to create a program that reads in a list of integers into an array with base type int. Provide the facility to either read this array from the keyboard or from a file. My code is below.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int numbers[50];
int num;
int i;
do
{
cout<<"Enter number of integers you want to input(1-50): ";
cin>>num;
if(num<=0 || num>50)
cout<<endl<<"Invalid number, try again."<<endl;
}while(num<=0 || num>50);
cout <<endl<< "Enter numbers:"<<num<<endl;
for(i=0;i<num;i++)
{
cin >> numbers;
}
for(i=0;i<num;i++)
{
for(int j=0;j<num-i-1;j++)
{
if(numbers[j]>numbers[j+1])
{
int temp = numbers[j];
numbers[j] = numbers[j+1];
numbers[j+1] = temp;
}
}
}
int number;
int count=0;
int count2=0;
cout<<endl<<"N Count"<<endl;
for(i=0;i<num;i++)
{
number=numbers;
for(int j=0;j<num;j++)
{
if(number==numbers[j])
{
count2++;
count=j;
}
}
cout<<endl<<numbers<<" "<<count2;
i=count;
count2=0;
}
cout<<endl;
system("pause");
return 0;
}
Explanation / Answer
its not any type of programme error its technical error check the installation of ur programme or try to run any other programme
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.