小编dha*_*rag的帖子

const char*和char*

我明白那个

char *s = "Hello World!" ; 
Run Code Online (Sandbox Code Playgroud)

存储在只读存储器中,并且不能通过指针修改字符串文字.

这有什么不同

const char *s = "Hello World!"; 
Run Code Online (Sandbox Code Playgroud)

也是'string'char*或const char*的类型?

c++ const char

6
推荐指数
2
解决办法
411
查看次数

Hibernate与实体豆

什么是使用Hibernate vs实体bean的优势,反之亦然?

我可以清楚地看到Hibernate与JDBC的优点,但当我在采访中被问到这一点时,我偶然发现了.

hibernate ejb

4
推荐指数
1
解决办法
4950
查看次数

在C++中漂亮地打印std :: vector

我怎么漂亮打印std::vector?例如,如果我构造一个std::vector<int>(6, 1),我可以运行它来获得像{1 1 1 1 1 1}C++ 一样的输出吗?它必须是通用的,因为大小和值可能会改变,因此std::vector<int>(4, 0)也是如此{0 0 0 0}.

c++ stdvector

3
推荐指数
1
解决办法
2518
查看次数

检查字符串是否具有唯一字符

我知道如何检查字符串是否有唯一的字符,但我想显示NOT UNIQUE,即使它们是不同的情况

例如 - 我的算法

string ="dhAra"=>独特

我认为会更好的是它显示NOT UNIQUE因为它有'a'两次

#include<iostream>

int main()
{
string str = "dhAra";
bool arr[128] = {0};

for (unsigned int i = 0; i < str.length() ; i++)
{
 int val = str[i];  //i think something needs to change here 
 cout << val << endl; 

 if(arr[val])
 { 
  cout << " not unique" ; 
  return 0; 
 }
 else
 { arr[val] = 1;} 
}
cout << "unique" ; 
return 0 ; 
}
Run Code Online (Sandbox Code Playgroud)

c++ algorithm

3
推荐指数
1
解决办法
2956
查看次数

标签 统计

c++ ×3

algorithm ×1

char ×1

const ×1

ejb ×1

hibernate ×1

stdvector ×1