break语句不在循环或switch语句中?

时间:2016-01-14 20:24:01

标签: c++ break

我的代码遇到问题,我已经在本网站上阅读过有关此问题的其他论坛,但它们与我的情况并不相关。我是C ++的新手,我几乎没有进入课程大约3周。我不知道为什么我的休息声明不起作用,对我来说它是在循环中。我错过了什么?

factura.find("*[style]").removeAttr('style')

1 个答案:

答案 0 :(得分:0)

这样的东西?

float a[60][7];
int row = 0;

std::cout << "How many students would you like to grade?" << std::endl;
std::cin >> studentNum;

n = studentNum - 2;

std::cout << "Enter grades for the first student" << std::endl;
while (row <= n)
{
  a[row][0] = k;
  a[row][0] = row;
  std::cout << "Enter grade for test 1: ";
  std::cin >> a[row][1];
  std::cout << "Enter grade for test 2: ";
  std::cin >> a[row][2];
  std::cout << "Enter grade for test 3: ";
  std::cin >> a[row][3];
  std::cout << "Enter grade for test 4: ";
  std::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;

  if (row==n)
  {
    std::cout << "Enter Grades for the last Student" << std::endl;
    std::cout << "Enter grade for test 1: ";
    std::cin >> a[row][1];
    std::cout << "Enter grade for test 2: ";
    std::cin >> a[row][2];
    std::cout << "Enter grade for test 3: ";
    std::cin >> a[row][3];
    std::cout << "Enter grade for test 4: ";
    std::cin >> a[row][4];
  }
  else
  { 
    std::cout << "Enter grades for the next student" << std::endl;
  }

  row++;
}

std::cout << "Student" << "\t" << "Grade1" << "\t" << "Grade2" << "\t" << "Grade3" << "\t" << "Grade4" << "\t" << "Avg1" << "\t" << "Avg2" << std::endl;
printarray(a, studentNum);

std::cin.get();
return 0;

P.S。

时用固定编辑