TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rahul Patil
1.6k
183
30.8k
Invalid type[int][int] for array subscript in c++?
Feb 26 2020 10:53 AM
I m new in c++ how to solve error:
main.cpp: In function ‘
int
main()’:
main.cpp:25:47: error: invalid types ‘
int
[
int
]’
for
array subscript
result[size]=add(num1[size],num2[size]);
^
main.cpp:25:58: error: invalid types ‘
int
[
int
]’
for
array subscript
result[size]=add(num1[size],num2[size]);
^
main.cpp:25:59: error: ‘add’ was not declared
in
this
scope
result[size]=add(num1[size],num2[size]);
^
main.cpp:30:52: error: invalid types ‘
int
[
int
]’
for
array subscript
result[size]=subtract(num1[size],num2[size]);
^
main.cpp:30:63: error: invalid types ‘
int
[
int
]’
for
array subscript
result[size]=subtract(num1[size],num2[size]);
^
main.cpp:30:64: error: ‘subtract’ was not declared
in
this
scope
result[size]=subtract(num1[size],num2[size]);
^
main.cpp:34:52: error: invalid types ‘
int
[
int
]’
for
array subscript
result[size]=multiply(num1[size],num2[size]);
^
main.cpp:34:63: error: invalid types ‘
int
[
int
]’
for
array subscript
result[size]=multiply(num1[size],num2[size]);
c++ programme:
using
namespace
std;
#include
int
main()
{
int
size,num1,num2;
char
operation[size];
int
result[size];
do
{
cout <<
"Crud Operation in c++ : \n"
<<
" + --- Addition \n"
<<
" - --- Subtraction \n"
<<
" * --- Multiplication \n"
<<
" / --- Division \n"
<<
" % --- Remainder \n"
;
cout<<
"Answer: "
;
cin>>operation[size];
cout<
switch
(operation[size])
{
case
'+'
:
result[size]=add(num1[size],num2[size]);
cout<
break
;
case
'-'
:
result[size]=subtract(num1[size],num2[size]);
break
;
case
'*'
:
result[size]=multiply(num1[size],num2[size]);
break
;
case
'/'
:
if
(num2[size]==0)
{
system(
"cls"
);
cout<<
"ANY NUMBER DIVIDED BY ZERO IS: UNDEFINED.\n\n"
;
continue
;
}
result[size]=divide(num1[size],num2[size]);
break
;
case
'%'
:
result[size]=remainder(num1[size],num2[size]);
break
;
default
:
operation[size]= 0;
system(
"cls"
);
cout<<
"PLEASE ENTER A VALID OPERATION.\n\n"
;
cout<<
"First Number: "
<
cout<<
"Second Number: "
<
cout<
}
}
while
(!(operation[size]));
}
how to solve this error help?
why my programme is not run which place I m going wrong?
Reply
Answers (
1
)
bluetooth programming for unity 3d
how to Remove PUSH BUTTON Border?