Use of Files in C++ Programming

I want to develop a program that will input records of ten students and write these into a sequential file. The record of a student contains the following fields:
Name, address, Marks of three subjects (s1, s2, s3)
Then calculate total marks and also find out the grade of each student. The issue is that whenever I create a file in the system drive and want to write records on it, the compiler gives error that file no exists. Guide me why this error occurs and what will be the solution? Waiting.
