#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int r,c;
//reading row and column size
cout<<"Enter row and column size:";
cin>>r>>c;
int u[r][c];//user matrix
int random[r][c];//random matrix
//reading user matrix values from input
cout<<"Enter matrix values:\n";
for(int i=0;i<r;i++)
for(int j=0;j<c;j++)
{
cout<<"Array["<<i<<"]["<<j<<"]:";
cin>>u[i][j];//reading input
}
//now generating random matrix
for(int i=0;i<r;i++)
for(int j=0;j<c;j++)
{
random[i][j] = rand()%100;
}
//displaying both matrices
cout<<"Your matrix:\n";
for(int i=0;i<r;i++){
for(int j=0;j<c;j++)
cout<<u[i][j]<<" ";
cout<<endl;}
cout<<"Random matrix:\n";
for(int i=0;i<r;i++){
for(int j=0;j<c;j++)
cout<<random[i][j]<<" ";
cout<<endl;}
//now checking they are equal are not
bool check=false;
for(int i=0;i<r;i++)
for(int j=0;j<c;j++)
if(u[i][j]!=random[i][j])check=true;
if(check)
cout<<"They are not equal\n";
else
cout<<"They are equal\n";
return 0;
}
output:
Enter row and column size:2 2
Enter matrix values:
Array[0][0]:1
Array[0][1]:2
Array[1][0]:1
Array[1][1]:2
Your matrix:
1 2
1 2
Random matrix:
41 67
34 0
They are not equal
Process exited normally.
Press any key to continue . . .
C++ need help with comments and explanation Ctt co de formasix assay with rowd culuma dize....
C++, and comments and explanation, please.
C++, and comments and explanation, please.
Input: the program should read the followings: First line, an integer . Second line, an integer n
Please I need help with this c++ code. please show all
steps , write comments and show sample runs. Thank you.
1. The Federal Bureau of Investigation (FBI) has recently changed its Universal Control Numbers (UCN) for identifying individuals who are in the FBI's fingerprint database to an eight-digit base 27 value with a ninth check digit. The digits used are: 0123456789ACDE FHJKLMNPRTVWX Some letters are not used because of possible confusion with other digits: B->8, G->C, I- >1, 0->0,...
I
need help with this exercise. Thank you for your help
Language is C++
6. Write a program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number. (Note: An even number is prime if it is 2. An odd inte- ger is prime if it is not divisible by any odd integer less than or equal to the square root of the number.)
I need help with this assignment. Please include comments throughout the program. Thanks Develop an algorithm and write the program in java for a simple game of guessing at a secret five-digit code. When the user enters a guess at the code, the program returns two values: the number of digits in the guess that are in the correct position and the sum of those digits. For example, if the secret code is 13720, and the user guesses 83521, the...
I am writing C++ code, and I need help for this. Create a program that will convert a decimal value into Roman numeral, and output the result. The program will ask for an integer input, assume all inputs are valid, and the program should not end unless the user tells you to. C++ code.
I need help with coding with c++. I need to make a lottery program where you enter in 5 numbers from 0-9 and the program will generate 5 random numbers 0-9 to represent the lottery numbers. I'm almost done, but the output isn't exactly what I want. It works fine, but the format should look like this: lottery array: 7 4 9 1 3 user array: 4 2 9 7 p.s. I also need to count how many matching numbers...
I need help with the explanation and solution with the whole
question.
Chapter 18 Homework, Part 6 Help Save & Exit Submit Check my work Part 1 of 2 Required information The following information applies to the questions displayed below.) Hudson Co. reports the contribution margin income statement for 2017 points HUDSON CO. Contribution Margin Income Statement For Year Ended December 31, 2017 Sales (11,100 units at $375 each) Variable costs (11,100 units at $300 each) Contribution margin Fixed costs...
I need help writing a C programming code. I am trying to create a program that returns ANY given number's decimal value as an Integer (Whole number). Examples: User input: 0.35 Output: 35 User input: 1.465 Output: 465 User input: 10.6054 Output: 6054
Need help with following C++ program: 3) Write a program in C++ with a menu. When the program executes it gives the user a list of choice to choose from. The user can input 1,2 or 3 only. For all other input, the message “Invalid Options” will be displayed. ****MENU**** 1) Convert length from feet to inches. 2) Convert length from meter to centimeters. 3) To quit the program
I need help with the C++ for the following problem: Write a program that can store and output 5 integers, where the user can input its value into an array named arrayValue. The program should implement the following: 1. Calculate the sum and average of the array. 2. Output the content (value) that stored in the array of five elements. 3. Continue to ask the user to store for storing data into another array.