Question

Write and explain the program that finds how many values ​​are different from each other in...

Write and explain the program that finds how many values ​​are different from each other in matrix A of the mxn type entered from the keyboard and transfer it to the B array using this. C++
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

#include <iostream>

using namespace std;

int main(){

int m,n;

cout<<"Enter m value:";

cin>>m;

cout<<"Enter n value:";

cin>>n;

int data[m][n];

for(int i=0;i<m;i++){

for(int j=0;j<n;j++){

int dataval;

cout<<"Enter element:";

cin>>dataval;

data[i][j]=dataval;

}

}

int outdata[m+n];

int pos=0;

for(int i=0;i<m;i++){

for(int j=0;j<n;j++){

int check=0;

for(int k=0;k<m;k++){

for(int p=0;p<n;p++){

if(data[i][j]==data[k][p]){

check=check+1;

}

}

}

if(check==1){

outdata[pos]=data[i][j];

pos=pos+1;

}

}

}

for(int i=0;i<pos;i++){

cout<<outdata[i]<<" ";

}cout<<endl;

}

#output;

user@user-Latitude - 3490:-/Desktop$ g++ 1.cpp user@user-Latitude - 3490:-/Desktop$ ./a.out Enter m value:3 Enter n value:3 E

#if you have any doubt or more information needed comment below..i will respond as possible as soon..thanks..

Add a comment
Know the answer?
Add Answer to:
Write and explain the program that finds how many values ​​are different from each other in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C language program that will prompt for 12 different resistor values, entered one at...

    Write a C language program that will prompt for 12 different resistor values, entered one at a time via the keyboard, expressed in Ohms. Valid values are 0.01 Ohm up to 10,000,000,000 Ohms. Write each entry to a text file on the disk thus: Resistor 1 Ohmic value = 2200. Update the resistor number for each of the 12 entries. Do not repeat any resistance value. Write a second C language program to read the 12 entries from the text...

  • 3. Write a complete C++ program that finds and prints the sum of values from 1...

    3. Write a complete C++ program that finds and prints the sum of values from 1 to N where N is a positive value > 10 entered by the user. If the user inputs a value less the 10 ask him to re-enter the value again and again until the value is valid. (20 Points)

  • Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds...

    Question 4-6 Please. Python 3.6. def main(). entered by a user. Write a program that finds the sum and average of a series of numbers he program should first prompt the user to enter total numbers of numbers are to be summed and averaged. It should then as for input for each of the numbers, add them, and print the total of the numbers and their average 2. Write a progra m that finds the area of a circle. The...

  • In C++ 1. Write a program that allows a user to enter 10 integer values from...

    In C++ 1. Write a program that allows a user to enter 10 integer values from the keyboard. The values should be stored in an array. 2. The program should then ask the user for a number to search for in the array: The program should use a binary search to determine if the number exists in a list of values that are stored in an array (from Step #1). If the user enters a number that is in the...

  • // Write a program that determines how many of each type of vowel are in an...

    // Write a program that determines how many of each type of vowel are in an entered string of 50 characters or less. // The program should prompt the user for a string. // The program should then sequence through the string character by character (till it gets to the NULL character) and count how many of each type of vowel are in the string. // Vowels: a, e, i, o, u. // Output the entered string, how many of...

  • In C please! Thank you! Write a program that finds the smallest (min), largest (max), and...

    In C please! Thank you! Write a program that finds the smallest (min), largest (max), and average (mean) of N values entered by the user. Your program should begin by prompting the user for N, the number of values to be entered. Then the program should accept that number of values, determining the min, max, and mean. Then it should display those values. This is an extension of a previous lab. First, get it working for N values. Then, extend...

  • Write a java program that will read the values for 3 matrices A, B, and C...

    Write a java program that will read the values for 3 matrices A, B, and C and store the result of their summation in matrix D. You need to use a method to read matrix values. Use another method to add the three 3x3 matrices (each is a 2 dimensional array with 3 rows and 3 columns). Finally, use a third method to print the value of the summation (matrix D). Write a test program that will cal the three...

  • Write a c program that finds the uncommon elements from two array elements using pointers only...

    Write a c program that finds the uncommon elements from two array elements using pointers only . For example : Enter the length of the array one : 5 Enter the elements of the array one: 9 8 5 6 3 Enter the length of the array two: 4 Enter the elements of the array two: 6 9 2 1 output: 8 5 3 2 1 void uncommon_ele(int *a, int n1, int *b, int n2, int *c, int*size); The function...

  • programming language must be in BASIC Write a program that finds how many times a prime...

    programming language must be in BASIC Write a program that finds how many times a prime number is obtained when a dice is tossed 100 times.

  • 3. (c-program) Write a program that finds the largest and smallest value in a series of...

    3. (c-program) Write a program that finds the largest and smallest value in a series of numbers entered by a user. The user must enter 25 values. Note if that if the user enters "0" they must correct and add another number. Print out the original entered values, the largest number, the smallest number. Note whether the user tried to enter "O".

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT