hello every programmer here , I'm looking for answers for this questions so plz help me out
1- write a program which read a string contains a number followed by an operation there anther number (e.g "25*3"), the program must preform the operation between the two numbers than print the result
i know the reading and printing the array
reading like that
but we need 2 arrays one is char and the two is int
lets say char A[6]
and int B[6]
Code:
char A[6];
for(i=0;(A[i]=getchar())!='\n';i++);
A[i]='\0';
Code:
for(i=0;B[i]!='\0';i++)
cout<<B[i];
but the process still unknown
i know that we can convert like that
Code:
for(i=0;A[i]!='\0';i++)
n=n*10+A[i]-'0';
but the operation ? and the result ?
_____________________________________________
2- write a c++ program to read A of 10 and B of 10 the program should compute the exert
3 arrays of the same size
A[10] , B[10],Z[10]
Z for the numbers that found in A and B put it in Z
also the processing
Code:
for(i=0;i<10;i++)
if(A[i]==B[i])
z[i];
_____________________
3- write a program to exchange the elements of second row with the elements with 3 row of array n*n
Code:
int n;int A[10][10],i,j,temp;
cin>>n;
for(i=0;i<n;i++)
for(j=o;j<n;j++)
cin>>A[i][j];
for(i=0;i<n;i++)
{
temp=A[1][i];
A[1][i]=A[n-1][i];
A[n-1][i]=temp;
}
________________________