我正在使用mongodb以下列方式存储时间序列数据
float a[60][7];
int row;
cout << "How many students would you like to grade?" << endl;
cin >> studentNum;
cout << "Enter grades for the first student" << endl;
row = 0;
n = studentNum - 2;
while (row < studentNum)
{
a[row][0]=k;
a[row][0] = row;
cout << "Enter grade for test 1: ";
cin >> a[row][1];
cout << "Enter grade for test 2: ";
cin >> a[row][2];
cout << "Enter grade for test 3: ";
cin >> a[row][3];
cout << "Enter grade for test 4: ";
cin >> a[row][4];
a[row][5] = (a[row][1] + a[row][2] + a[row][3] + a[row][4]) / 4;
a[row][6] = a[row][1] * 0.2 + a[row][2] * 0.3 + a[row][3] * 0.3 + a[row][4] * 0.2;
row++;
}
if (row == n)
{
cout << "Enter Grades for the last Student" << endl;
cout << "Enter grade for test 1: ";
cin >> a[row][1];
cout << "Enter grade for test 2: ";
cin >> a[row][2];
cout << "Enter grade for test 3: ";
cin >> a[row][3];
cout << "Enter grade for test 4: ";
cin >> a[row][4];
break;
}
else
{
cout << "Enter grades for the next student" << endl;
row = row + 1;
}
cout << "Stdnt" << "\t" << "Grade1" << "\t" << "Grade2" << "\t" << "Grade3" << "\t" << "Grade4" << "\t" << "Avg1" << "\t" << "Avg2" << endl;
printarray(a, studentNum);
cin.get();
return 0;
但现在我想更新特定的范围值 例如。我想将所有值设置为0大于 values.30.40 ,其中 VALUES是主节点,30是MINUTES,40是SECOND
答案 0 :(得分:0)
是否可以将内部Json更改为数组? 这样,您就可以使用索引访问和修改。 当您在某些索引中没有值时,它也会有所帮助。
values: {
0:{[12,25,36,........,12]},
.
.
.
}