Write a C++ program that will use a two-dimensional array to create and store th
ID: 3863362 • Letter: W
Question
Write a C++ program that will use a two-dimensional array to create and store the multiplication tables for the integers 1-10. The table shall be created in a function name “multiply_me” and outputted in the main function. You must use global variables to transfer information to and/or from the table. Your output shall be neatly displayed on the console. all programs ( unless otherwise noted) must prompt the user to rerun the program by typing "yes" or "Yes" . Upon exiting the program, you must “thank the user” for using it. (Programmed in C++)
Explanation / Answer
//
// main.cpp
// table
//
// Created by Nishant Kumar on 18/03/17.
// Copyright © 2017 Nishant Kumar. All rights reserved.
//
#include <iostream>
using namespace std;
int i,j,a,b;
int** multiply_me(int rows, int columns){
int** table = new int*[rows];
for(int i = 1; i <=rows; i++) {
table[i] = new int[columns];
for(int j = 1; j <= columns; j++){ table[i][j] = (i*j); }// sample set value;
}
return table;
}
int main(int argc, char** argv){
int** table = multiply_me(10, 10);
string s;
while(1){
for(int i = 1; i <= 10; i++){
for(int j = 1; j <= 10; j++){
printf("%d",table[i][j]);
printf(" ");
}
cout<<endl;
}
printf("Do you Want to Continue:Press Yes or No ");
cin>>s;
if(s=="yes"||s=="YES")continue;
else{
cout<<"thank you"<<endl;
break;
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.