質問編集履歴
2
文字列という事で修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
cCust2 customer[100];
|
19
19
|
|
20
20
|
strcpy((char*)customer[0].sOrder, "ABC");
|
21
|
-
// customer[0].sOrder = "ABC";
|
21
|
+
// customer[0].sOrder[0] = "ABC";
|
22
22
|
if (customer[0].sOrder[0].compare('A')) {
|
23
23
|
cout << "OK" << endl;
|
24
24
|
}
|
1
クラスで困っている事修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Sringの一文字目が’A'かどうかの処理をお伺いしてよろしいでしょうか?
|
1
|
+
【修正】Sringの一文字目が’A'かどうかの処理をお伺いしてよろしいでしょうか?
|
test
CHANGED
@@ -9,23 +9,25 @@
|
|
9
9
|
### 発生している問題・エラーメッセージ
|
10
10
|
|
11
11
|
```
|
12
|
-
#include <iostream>
|
13
|
-
|
12
|
+
class cCust2 {
|
13
|
+
public:
|
14
|
-
|
14
|
+
string sOrder[20];
|
15
|
+
};
|
15
16
|
|
16
|
-
using namespace std;
|
17
|
-
int main() {
|
17
|
+
int main__() {
|
18
|
+
cCust2 customer[100];
|
19
|
+
|
18
|
-
str
|
20
|
+
strcpy((char*)customer[0].sOrder, "ABC");
|
19
|
-
c
|
21
|
+
// customer[0].sOrder = "ABC";
|
20
|
-
if (strcmp(
|
22
|
+
if (customer[0].sOrder[0].compare('A')) {
|
21
|
-
cout << OK << endl;
|
23
|
+
cout << "OK" << endl;
|
22
24
|
}
|
23
25
|
}
|
24
26
|
```
|
25
27
|
と実装したが
|
26
28
|
```
|
27
29
|
重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
|
28
|
-
エラー (アクティブ) E04
|
30
|
+
エラー (アクティブ) E0304 オーバーロードされた関数 "std::basic_string<_Elem, _Traits, _Alloc>::compare [代入_Elem=char, _Traits=std::char_traits<char>, _Alloc=std::allocator<char>]" のインスタンスが引数リストと一致しません ConsoleApplication2
|
29
31
|
```
|
30
32
|
|
31
33
|
上記 関数の使用方法が違うのか
|