.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> File Operation >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

PROGRAMME TO APPEND DATA IN FILE

Posted By:Nikhil Kumar       Posted Date: February 28, 2010    Points: 10    Category: File Operation    URL: http://www.dotnetspark.com  

PROGRAMME TO APPEND DATA IN FILE IN C PROGRAMMING...
 

 

////PROGRAMME TO APPEND DATA IN FILE////
 
#include
#include
#include
#include
 
class stu {int rollno;
                               char name[10];
                               char cl[4];
                               float marks;
                               char grade;
                               public:
                               void getdata()
                               {
                               cout<<"ROLL NO:";
                               cin>>rollno;
                               cout<<"name:";
                               gets(name);
                               cout<<"CLASS:";
                               gets(cl);
                               cout<<"MARKS ARE:";
                               cin>>marks;
                               if (marks>=75) grade='A';
                               else if(marks>=60) grade='B';
                               else if(marks>=50) grade='C';
                               else grade='F';
                               }
                               void putdata()
                               {
                               cout<>ans;
}
fo.close();
}
 
OUTPUT 
                     //use of data file handling
ROLL NO:1
NAME:AREEB
 
CLASS:12 A
MARKS ARE:78
RECORD ADDED TO FILE
WANT TO ENTER MORE RECORDS?y
ROLL NO:2
NAME:HARSH
CLASS:12 A
MARKS ARE:98
RECORD ADDED TO FILE
WANT TO ENTER MORE RECORDS?y
ROLL NO:3
NAME:ANANT
CLASS:12 A
MARKS ARE:56
RECORD ADDED TO FILE
WANT TO ENTER MORE RECORDS?
 
 
 
DATA IS STORED AS:
 
AREEB    12 A 78 
HARSH    12 A 98 
ANANT    12 A 56



Thanks !!!

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend