Matrix1. Даны целые положительные числа M и N. Сформировать целочисленную матрицу размера M × N, у которой все элементы I-й строки имеют значение 10*I (I = 1, …, M).
>Решение Pascal
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | program Matrix1; var a:array [1..10,1..10] of integer; M, N, i, j:Integer; begin Write('M: '); Readln(M); Write('N: '); Readln(N); for i:=1 to M do for j:=1 to N do a[i,j]:=i*10; for i:=1 to M do begin for j:=1 to N do Write(' : ',a[i,j]); writeln(' : '); end; end. |
пж сделайте на С++
А почему нет решения на языке С++ именно этих заданий нужны
Пожалуйста сделайте и помогите нам всем.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Matrix1
{
class Program
{
static void Main(string[] args)
{
int[,] MyMatrix = new int[3,3];
for(int i = 0; i < 3; i++)
{
for(int j = 0; j < 3; j++)
{
Console.WriteLine("Y: "+i+"X: "+j);
MyMatrix[i, j] = int.Parse(Console.ReadLine());
}
Console.WriteLine();
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
MyMatrix[i, 0] = 10*MyMatrix[i, 0];
Console.WriteLine(MyMatrix[i,j]);
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
это все ошибка
это все ошибка
че это не правильно всё
#include
#include
#include
using namespace std;
main(){
int M, N, i, j;
srand(time(NULL));
do {cout<>M;} while (M<1);
do {cout<>N;} while (N<1);
int matrix[M][N]{};
// for (i=0;i<N;i++){A[i]=rand();}
for (i=1;i<=M;i++){
for (j=1;j<=N;j++){matrix[i][j]=10*i;}}
for (i=1;i<=M;i++){
for (j=1;j<=N;j++){cout<<" "<<matrix[i][j];}cout<<endl;}
return 0;}
int m,n;
cout<> «;cin>>m;
cout<> «;cin>>n;
int arr[m][n] = {};
int ilen = sizeof(arr) / sizeof(arr[0]);
int jlen = sizeof(arr[0]) / sizeof(arr[0][0]);
for(int i = 0;i<=m;i++){
for(int j = 0;j<n;j++){
arr[i][j] = i*10;
cout<<arr[i][j]<<" ";
}
cout<<endl;
}
int m,n;
cout<> «;cin>>m;
cout<> «;cin>>n;
int arr[m][n] = {};
for(int i = 0;i<=m;i++){
for(int j = 0;j<n;j++){
arr[i][j] = i*10;
cout<<arr[i][j]<<" ";
}
cout<<endl;
}
пж C#