删除 char[10][10] 中的一行

Posted hurryxin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了删除 char[10][10] 中的一行相关的知识,希望对你有一定的参考价值。

1. 描述

删除二维字符数组其中一行,并用下一行进行填补

2. 代码

#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    char tmp[3][5];
    cin>>tmp[0]>>tmp[1]>>tmp[2];
//    cout<<tmp[0]<<endl<<tmp[1]<<endl<<tmp[2]<<endl;
    for(int i=0;i<2;i++)
    {
        strcpy(tmp[i],tmp[i+1]);
    }
    cout<<endl;
    cout<<tmp[0]<<endl<<tmp[1]<<endl;
    return 0;
}

以上是关于删除 char[10][10] 中的一行的主要内容,如果未能解决你的问题,请参考以下文章