Store details using structure
The source code for program that store details of a student in a structure, copy it in note pad and save it as “.cpp”. The “.cpp” and “.exe ” files will soon be avalible to download.
/*
*
* Copyright 2011 techstream.org < techstream.org[at]gmail.com >
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
# include
# include //to use clear screen function
void main()
{
clrscr();
struct stud{
int rollno;
char name[25];
int total;
}s1;
cout<<"n enter your roll number: ";
cin>>s1.rollno;
cout<<"enter your name: ";
cin>>s1.name;
int m1,m2,m3,m4,m5,total;
cout<<"enter mark 1 " ;
cin>>m1;
cout<<"enter mark 2 " ;
cin>>m2;
cout<<"enter mark 3 " ;
cin>>m3;
cout<<"enter mark 4 " ;
cin>>m4;
cout<<"enter mark 5 " ;
cin>>m5;
total=m1+m2+m3+m4+m5;
cout<<"roll no "<