我需要做什么来修复程序上的未初始化错误?该程序假设打印一个数字所具有的除数,但一直显示一个错误,说明变量 c 未初始化。
/*
/ Name: Ralph Lee Stone
/ Date: 10/10/2013
/ Project: RLStone3_HW_08
/ Description: This program gets a positive value and determines the number of divisors it has.
*/
#include <iostream>
using namespace std;
int DivisorCount(int x)
{
int counter = 0;
for(int c; x < c; c++)
{
if (x%c==0)
counter++;
}
return counter;
}
int main()
{
int x;
cout << "Please a positive value: ";
cin >> x;
cout << x << "has this many divsors: " << DivisorCount(x);
}