2个回答
展开全部
#include <stdio.h>
#include <malloc.h>
void main()
{
int i ,j;
int n;
int **a = (int**)malloc(sizeof(int*) * n);
scanf("%d", &n);
for(i = 0; i < n; i++)
{
a[i] = (int*)malloc(sizeof(int) *n);
if(a[i])
{
for( j = 0; j < n; j++)
{
scanf("%d", &a[i][j]);
}
}
}
for(i = 0; i < n; i++)
{
for( j = 0; j < n; j++)
{
printf("%d", a[i][j]);
}
}
}
#include <malloc.h>
void main()
{
int i ,j;
int n;
int **a = (int**)malloc(sizeof(int*) * n);
scanf("%d", &n);
for(i = 0; i < n; i++)
{
a[i] = (int*)malloc(sizeof(int) *n);
if(a[i])
{
for( j = 0; j < n; j++)
{
scanf("%d", &a[i][j]);
}
}
}
for(i = 0; i < n; i++)
{
for( j = 0; j < n; j++)
{
printf("%d", a[i][j]);
}
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#include <iostream>
using namespace std;
int main()
{
int n;
int **a;
scanf("%d", &n);
a = new int*[n];
for (int i = 0; i < n; i++)
a[i] = new int[n];
for (int i = 0; i < n; i++)
delete[] a[i];
delete[] a;
}
using namespace std;
int main()
{
int n;
int **a;
scanf("%d", &n);
a = new int*[n];
for (int i = 0; i < n; i++)
a[i] = new int[n];
for (int i = 0; i < n; i++)
delete[] a[i];
delete[] a;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询