C program to create a file student.dat, C/C++ Programming

Program is to create a file student.dat:

Program is to create a file student.dat which contains all name, roll_no,marks(5 sub) and percentage

  class student



    char name[20];

    int roll;

    int marks[5];

    int total;

    float perc;






     void input();

     void output();



 void student::input()



  cout<<" enter your name ";


  cout<<" enter your roll no. ";


  cout<<" enter the marks of five subjects "<<"\n";

  for (int i=0;i<5;i++)


    cout<<" enter marks";


    total=total + marks[i];



 void student::output()




    if (perc>=60)


     cout<<" the name is "<

     cout<<" the total marks obtained out of (500) "<

     cout<<" the percentage "<



     cout<<" the percten tage is less then 60 ";



  void main()



   student info;

   fstream file;


   int n;

   cout<<" enter the number for which u want to enter data";


   for(int i=1;i<=n;i++)



     file.write((char *)& info,sizeof(info));






    file.write((char *)& info,sizeof(info));





Posted Date: 10/19/2012 5:39:41 AM | Location : United States

Related Discussions:- C program to create a file student.dat, Assignment Help, Ask Question on C program to create a file student.dat, Get Answer, Expert's Help, C program to create a file student.dat Discussions

Write discussion on C program to create a file student.dat
Your posts are moderated
Related Questions
wap to count the numof string present in a word

Write a program that reads a line of characters from the user and displays that entire line after converting any uppercase characters to lowercase also change any lowercase charact

Write a program that performs character processing on 10 characters read in from a file, and writes the results to output files. Do NOT use loops or arrays to solve this problem. N

Explain about the strategies of implementation of the statecharts, Database Management System?

Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process wi

Write a program in C language to implement Two-Way Merge Sort. Input the following data to the program. Show all intermediate steps: 84, 83, 78,90,23,123,98,159,8,200

C program to print L diagonal triangle: void main() {                 int i=0,j=0;                 int arr[rows][cols];                 for (i=0; i

Q: How can one encourage his (older) compiler to check new to see automatically if it returns NULL?       A: His compiler eventually will. If he contain an old compiler wh

Many modern cryptography algorithms require two numbers that are coprime, or sometimes referred to as relatively prime. Two numbers are coprime if their greatest common divisor is