これは私が今持っているコードです:
int main() {
char stupac1, stupac2;
for (stupac1 = 'A'; stupac1 <= 'Z'; ++stupac1)
{
for (stupac2 = 'a'; stupac2 <= 'z'; ++stupac2)
// between the caps and the non caps there are 32 letters (ASCII code)
if(strcmp (reinterpret_cast <const char*> (stupac1),
reinterpret_cast <const char*> (stupac2)) == 32 )
{
cout <<stupac1 << stupac2 << endl;
}
else
{
cout << "These letters suck" << endl;
}
}
return 0;
}
タスク: 2 つの列に AZ と az の文字を含むテーブルを作成する 2 つの連続したループを含むプログラムを作成する必要があります。
を使用する必要がありますfor
が、不要strcmp
な場合は削除できます。私は何かを試していましたが、このコードを実行しても何も出力されず、クラッシュします。