Cycle does not work right

The problem is that the Text "Enter mark: " is loaded 2 times in a roll without giving a chance to enter anything the first time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  #include "stdafx.h"
#include<iostream>
#include<string>
#include<sstream>
using namespace std;
struct students
{
	string name;
	char facNo;
	int marks[3];
}student;
int main()
{
	cout << "Enter name of the student:";
	cin >> student.name;
	cout << "Enter the Faculty number:";
	cin >> student.facNo;
	for (int i = 0; i<3; i++)
	{
		cout << "Enter Mark: ";
		cin >> student.marks[i];
	}
	return 0;
}
Last edited on
Topic archived. No new replies allowed.