ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

自考新教材--p60_5_1

2019-12-03 09:02:31  阅读:14  来源: 互联网

标签:p60 include cout 新教材 ++ cin int 自考 string



源程序:

#include <iostream>

#include <string>

using namespace std;

int main()

{

  int n,i;

  cout << "输入几个字符串:";

  cin >> n;

  string *p;

  string *A = new string[n];

  p = A;

  cout << endl;

  cout << "请输入:";

  for (i = 0; i < n; i++)

    cin >> A[i];

  p = A;   //将指针重新指向数组的首地址

  cout << endl;

  cout << "您输入的字符串为:";

  for (i = 0; i < n; i++)

    cout << p[i]<<endl;

  delete []p;

  system("pause");

  return 0;

}

运行结果:



标签:p60,include,cout,新教材,++,cin,int,自考,string
来源: https://www.cnblogs.com/duanqibo/p/11974621.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有