値ました私は、私はそれを修正することができますどのように、私はゴミのメモリ値を得たC++での配列に練習を作っていたおかげでC++アレイの出力は、ゴミメモリが
#include<cstdlib>
#include<fsream>
#include<iostream>
#include<locale.h>
#include<string.h>
using namespace std;
string sone;
string stwo;
string sthree;
string sfour;
int one;
int two;
int three;
int four;
int main(int org, char** argv)
{
char array = { 'a', 'b', 'c', 'd' };
while (four <= 10)
{
three = 0
while (three <= 10)
{
two = 0
while (two <= 10)
{
one = 0
while (one <= 10)
{
setlocale(LC_CTYPE, "Local");
ofstream out("file.txt", ios::app);
sone = array[one];
stwo = array[two];
sthree = array[three];
sfour = array[four];
out << sfour + sthree + stwo + sone;
out << "\n";
out.close();
one++;
}
two++;
}
four++;
}
five++;
}
}
出力:
1-aaaa
2-aaab
3-aaac
4-aaad
5-aaa#
6-aaa?
7-aaa0
8-aaa#
9-aaa'
10-aaa_
11-aaa?
12-aaba
13-aabb
達成しようとしていることは何ですか?期待される成果は? – Pramod
コードにいくつかのバグがあります。いくつかは単純なタイプミスですが、 'four'は使用前に初期化されておらず、' while'ループのキーであるので、出力は非常に不愉快になります。 – user4581301
このような問題を解決する適切なツールは、デバッガです。スタックオーバーフローを尋ねる前に、コードを一行ずつ進める必要があります。詳しいヘルプは、[小さなプログラムをデバッグする方法(Eric Lippert)](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/)を参照してください。最低でも、あなたはあなたが行った観察と一緒に、[編集]あなたの質問あなたの問題を再現[、最小完全、かつ検証](http://stackoverflow.com/help/mcve)の例を含むようにする必要があります\しますデバッガ。 –