名前空間stdを使用して使用しないでください。

今日は、このような小さなプログラムエラー、エラーを書いた:カウントは明確ではありません

#include "stdafx.h"
#include<iostream>
using namespace std;

int count = 0;

int main()
{
    for (int i = 0; i < 10; i++)
    {
        static  int number = 0;
        for (int j = i; j < 10; j++)
        {
            number++;
            cout << number << endl;
            count++;
        }


    }


    cout << count << endl;
}

その後、グローバル変数は、STD回数内で定義され、これを避けるために多くの時間を過ごすためにして、名前を繰り返していた
のstd ::を使用して書き込みます

#include "stdafx.h"
#include<iostream>
using  std::cout;
using std::endl;

int count = 0;

int main()
{
    for (int i = 0; i < 10; i++)
    {
        static  int number = 0;
        for (int j = i; j < 10; j++)
        {
            number++;
            cout << number << endl;
            count++;
        }


    }


    cout << count << endl;
}

おすすめ

転載: blog.csdn.net/alexhu2010q/article/details/82023702
おすすめ