C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  117 Posts :: 2 Stories :: 61 Comments :: 0 Trackbacks

常用链接

留言簿(8)

搜索

  •  

最新评论

阅读排行榜

评论排行榜


第一个程序:
#include "stdafx.h"
#include 
<iostream>
#include 
<string>
using namespace std;
const int SIZE = 5;
void display(const string sa[], int n);
int main(int argc, char* argv[])
{
    
string list[SIZE];
    cout
<<"Enter your "<<SIZE<<" favorite astronomical sights:\n";
    
for(int i=0;i<SIZE;i++)
    
{
        cout
<<i+1<<"";
        getline(cin,list[i]);
    }

    cout
<<"Your list:\n";
    display(list,SIZE);
    
return 0;
}

void display(const string sa[], int n)
{
    
for(int i=0;i<n;i++)
        cout
<<i+1<<""<<sa[i]<<endl;
}
posted on 2010-02-12 19:41 烟皑 阅读(255) 评论(0)  编辑 收藏 引用 所属分类: C++ primer plus学习笔记

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理