首页
社区
课程
招聘
[求助]delphi 转学 VC++ 的遇到的数据类的"声明"问题
发表于: 2008-6-16 07:30 5072

[求助]delphi 转学 VC++ 的遇到的数据类的"声明"问题

2008-6-16 07:30
5072
因刚从 delphi 转学 VC++, 关于"字符串数组"使用上还不明白,

如:
   Delphi 声明字符串数组的方法
var
  Str : array [0..6] of String;

    VC++不知如何"声明"字符串数组

  #include <string>
  String Str[255]; // error C2146: syntax error : missing ';' before identifier 'Str'

  或大家介绍一下相关的书(VC++ 数据类的"声明", "使用")

  谢谢!!!

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (7)
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
#include <iostream>
using namespace std;

int main()
{
        char lpStr[255][255] = {
                "hello, Han Meimei",
                "hi, Lily",
                "good bye"
        };

       
        cout << lpStr[1] << endl;

        return 0;
}
2008-6-16 08:06
0
雪    币: 321
活跃值: (271)
能力值: ( LV13,RANK:1050 )
在线值:
发帖
回帖
粉丝
3
String Str[255]; 应该注意大小写。
string Str[255];
2008-6-16 08:58
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
// use class string

#include <iostream>
using namespace std;

int main()
{

        string lpStr[255];

        lpStr[1].assign("hello world");
        cout << lpStr[1].c_str() << endl;

        return 0;
}
2008-6-16 15:08
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
5
谢谢大家的帮助!!!!!!!!!
2008-6-17 03:18
0
雪    币: 209
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
VC怎么那么难学啊,看到代码就头晕,DELPHI还好一点
2008-6-19 12:42
0
雪    币: 189
活跃值: (4810)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
7
我刚接触了一下“VC++”,感觉 DELPHI 好像没 VC++ 灵活。。。。
2008-6-21 00:42
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
8
你也可以说OP严谨: )
2008-6-21 20:53
0
游客
登录 | 注册 方可回帖
返回
//