1.每日一道基础编程题目(牛客网)
前言
从今天起 我会日更一些编程题目(比较基础的)适合期末复习的题目 分享给大家 和大家一起进步
题目引入
首先我们先看一下这个代码 这个的意思实际上是关于输入和输出的一个先后顺序 我们是先输入后输出的
#include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[101];
for(int i=0;i<10;i++)
{
cin>>arr[i]; //输出是当输入完成之后 也就是说 输出是不会直接输出的而是在录入完所有的数据之后输出
cout<<arr[i];
}
return 0;
}
//这道题目的要求主要是将数据进行 在我看来是可以进行memcpy进行操作处理的
//首先我们需要知道的我们需要
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;//定义的是什么样的数据类型
int arr[n*m];
int arr1[n][m];
for(int i=0;i<m*n;i++)
{
cin>>arr[i];
}
memcpy(arr1, arr, sizeof(arr));//将一个数组的内容拷贝到另一个数组里面去
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cout<<arr1[i][j]<<" ";
}
cout<<endl;
}
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n = 0;
int m = 0;
int arr[100] = { 0 };
scanf("%d %d", &n, &m);
for (int i = 0; i < n; i++)//外部控制循环的
{
for (int j = 0; j < m; j++)
{
cin>>arr[i];//输出并不是直接输出的 而是在我们的数据输入完成之后 再进行打印的
printf("%d ", arr[i]);//这个则不是 这个是直接进行打印操作处理 就是 只要是拿到这个数据就进行打印处理
}
printf("\n");
}
return 0;
}
结语
今日刷的第一道题目 比较基础 继续加油!!
The problem comes when you start lose perspective on your work and direction
愿大家每天♥怀梦想 不断前进
oblem comes when you start lose perspective on your work and direction
愿大家每天💓怀梦想 不断前进!!
明天见