You are on page 1of 19

Made byGirish Arora XII-A

This is to certify that this project has been made by GIRISH ARORA of class XII-A on this topic under the guidance of our computer teacher Mrs. Sangeeta mam and has been completed it successfully.

Teacher signature

I would like to express my special thanks of gratitude to my teacher Mr. Sangeeta mam as well as our principal Mrs.S.Chatterjee who gave me the golden opportunity to do this wonderful project, which also helped me in doing a lot of Research and I came to know about so many new things I am really thankful to them. Secondly I would also like to thank my parents and friends who helped me a lot in finishing this project within the limited time. I am making this project not only for marks but to also increase my knowledge. Thanks again to all who helped me.

Content
Program 1: student management system Program 2: stock management Program 3: serial/episode Program 4: clothing system

Program to count upper case alphabets Program to count blank space Program to count vowels Program to count no. of the Program to count no. of lines starting with A

4/4/2013

Program-1
#include<conio.h> #include<fstream.h> #include<stdio.h> #include<stdlib.h> #include<string.h> class student { private: char name[20]; int roll_no; int admin_no; float a,b,c; float total; char school[30]; float percentage; char grade[10]; void assign() {total=a+b+c;

percentage=total/3; if(percentage>90) strcpy(grade,"A"); else if(percentage>=80 && percentage<=90) strcpy(grade,"B"); else if(percentage>=70 && percentage<80) strcpy(grade,"C"); else if(percentage>=60 && percentage<70) strcpy(grade,"D"); else if(percentage<60) strcpy(grade,"E"); } public: void enter() { cout<<"enter name --> "; gets(name); cout<<"enter roll no. -->"; cin>>roll_no; cout<<"enter admin no. -->"; cin>>admin_no; cout<<"enter school name -->"; gets(school); cout<<"enter marks in three subjects -->"; cin>>a>>b>>c; } void display() {clrscr(); assign(); cout<<"\ngrade="<<grade; cout<<"\nname="<<name; cout<<"\nmarks in three subjects="<<a<<"\t"<<b<<"\t"<<c; cout<<"\nroll no="<<roll_no; cout<<"\nadmin no.="<<admin_no; cout<<"\nschool="<<school; cout<<"\ntotal="<<a+b+c; cout<<"\n%="<<percentage;

} }; int main() { clrscr(); int ch; do { student s1; s1.enter(); s1.display(); { ofstream abc("student.txt",ios::binary); abc.write((char*)&s1,sizeof(s1)); ofstream fout("student1.txt",ios::app); fout.write((char*)&s1,sizeof(s1)); ofstream bin("student2.dat",ios::binary); bin.write((char*)&s1,sizeof(s1)); ofstream fin("student3.dat",ios::app); fin.write((char*)&s1,sizeof(s1)); }

cout<<"\n\nenter value"<<"\n1 to enter more"<<"\n2 to quit"; cout<<"\nvalue-->"; cin>>ch; cout<<"\n"; clrscr(); if(ch==2) exit(0); }while(ch==1); return 0; getch(); }

4/4/13

Program-2
#include<conio.h> #include<iostream.h> #include<stdio.h> class stock { int icode; char item[20]; float price; long int qty; float discount; void finddisc() { if(qty<=50) discount=0; if(qty>50 && qty<=100) discount=5; if(qty>100) discount=10; }public: void buy() {cout<<"enter item code-->"; cin>>icode; cout<<"enter item name-->"; gets(item); cout<<"enter price of item-->"; cin>>price; cout<<"enter quantity of item-->"; cin>>qty; finddisc();

} void showall() {cout<<"code="<<icode; cout<<"\nname="<<item; cout<<"\nprice="<<price; cout<<"\nquantity="<<qty; cout<<"\ntotal price="<<qty*price; cout<<"\ndisc. %="<<discount; cout<<"\ndisc. price="<<(discount/100)*qty*price; cout<<"\nprice after disc="<<(qty*price)-(discount/100*qty*price); }}; void main() { clrscr(); stock s; s.buy(); s.showall(); getch();
}

7/4/13

Program-3
#include<conio.h> #include<iostream.h> #include<stdio.h> #include<string.h> class serial { private: int serialcode; char title[20]; float duration; int noofepisodes; public: serial() { serialcode=0; duration=30; noofepisodes=10; strcpy(title,"null"); } void newserial() { cout<<"enter serial code-->"; cin>>serialcode; cout<<"enter title-->"; gets(title); } void otherentries() { cout<<"enter duration-->"; cin>>duration; cout<<"enter no of episodes-->"; cin>>noofepisodes; }

void dispdata() { cout<<"serial code="<<serialcode; cout<<"\ntitle="<<title; cout<<"\nduration="<<duration; cout<<"\nno of episodes="<<noofepisodes; }}; void main() {clrscr(); int a,b; serial s; s.newserial(); s.otherentries(); s.dispdata(); getch();
}

7/4/13

Program-4
#include<conio.h> #include<string.h> #include<iostream.h> #include<stdio.h> class clothing { char code[20]; char type[20]; float price; int size; char material[20]; void calc_price() { float factor; if(!strcmp(material,"cotton")) factor=1; else factor=0.75; if(!strcmp(type,"trouser")) price=1500*factor; else price=1200*factor; } public: clothing() { strcpy(code,"not assigned"); strcpy(type,"not assigned"); strcpy(material,"not assigned"); size=0; price=0; } void enter()

{ cout<<"enter code-->"; gets(code); cout<<"enter type(trouser or shirt)-->"; gets(type); cout<<"enter material-->"; gets(material); cout<<"enter size-->"; cin>>size; calc_price(); } void show() { cout<<"code="<<code; cout<<"\ntype="<<type; cout<<"\nmaterial="<<material; cout<<"\nsize="<<size; cout<<"\ntotal price="<<price; } }; void main() { clrscr(); clothing s; s.enter(); s.show(); getch(); }

Program to count upper case alphabets


{ Iftream fin(books.txt); While(fin.eof()); {fin.read(str,sizeof(str)); For(int i=0;i<str[i};i++) If(isupper(str[i]!=0) count++; } Fin.close(); Cout<<count; }

Program to count blank space


{ Iftream fin(books.txt); While(fin.eof()); {fin.read(str,sizeof(str)); For(int i=0;i<str[i};i++) If(str[i]== ) count++; } Fin.close(); Cout<<count;

Program to count vowels


{ Iftream fin(books.txt); While(fin.eof()); {fin.read(str,sizeof(str)); For(int i=0;i<str[i};i++) If((str[i-1]==\0 || str[i-1]== || str[i-1==.) && (str[i]==a || str[i]==A || str[i]==e || str[i]==E || str[i]==i || str[i]==I || str[i]==o || str[i]==O || str[i]==u || str[i]==U ))

count++; } Fin.close(); Cout<<count; }

Program to count no. of the


{ char word[100]; Iftream fin(books.txt); While(fin.eof()); {

Fin>>word; If(strcmp(word,the)==0) Count++; } Fin.close(); Cout<<count; }

Program to count no. of lines starting with A


{ Iftream fin(books.txt); While(fin.eof()); {fin.read(str,sizeof(str)); For(int i=0;i<str[i};i++) If(str[i]== A && str[i-1]==\0 || str[i]==A && str[i-1]==.) count++; } Fin.close(); Cout<<count; }

You might also like