SlideShare una empresa de Scribd logo
1 de 13
The Programs
Sum Of MatricesSum Of Matrices
Product Of Matrices
cout<<"Enter second matrix rowcout<<"Enter second matrix row
wise";wise";
for(i = 0; i<p; ++i)for(i = 0; i<p; ++i)
for(j = 0; j<q; ++j)for(j = 0; j<q; ++j)
cin>>B[i][j];cin>>B[i][j];
cout<<“product of the givencout<<“product of the given
two matrix is : “;two matrix is : “;
for(i = 0; i<m; ++i)for(i = 0; i<m; ++i)
{ cout<<“n”;{ cout<<“n”;
for(j = 0; j<n; ++j)for(j = 0; j<n; ++j)
{ C[i][j] = 0;{ C[i][j] = 0;
C[i][j] = C[i][j] + A[i][k] * B[k]C[i][j] = C[i][j] + A[i][k] * B[k]
[j];[j];
cout<< C[i][j] << “ “;cout<< C[i][j] << “ “;
}} }} }}
elseelse
cout<<“n the matrices are notcout<<“n the matrices are not
compatible for multiplication “;compatible for multiplication “;
getch();getch();
}}
Linear Search
Palindrome(string)
Stats of text
#include<iostream.h>
#include<conio.h>
#include<process.h>
void textstat( char str[], int &lc, int &wc, int &cc);
void main()
{ clrscr();
char str[255] = “ Hi how are you !! ”;
int lc, wc, cc;
cout<<“n Enter any string (~ to terminate) : “;
cin.getline(str, 255,’~’)
textstat(str, lc, wc, cc);
cout<< “number of lines in the string are: “<< lc;
cout<< “number of words in the string are: “<< wc;
cout<< “number of characters in the string are: “<< cc;
getch();
}
int wordcount(char str[])
{ int count = 1;
for (int i = 0; str[i] ‘0’; ++i)
{ if (str[i] == ‘i’ || str[i] == ‘n’)
{count ++;
while (str[i] ==‘ ‘)
i++; }
if (str[i]==‘0’)
i--;
}
return count;
}
int charcount(char str[])
int count = 0;
for (int i = 0; str[i] ‘0’; ++i)
count++;
return count;
}
int linecount(char str[])
{ int count = 1;
for (int i = 0; str[i] ‘0’; ++i)
if(str[i]==‘n’)
count++;
return count;
}
void textstat( char str[], int &lc, int &wc, int &cc)
{ lc = linecount(str);
wc = wordcount(str);
cc = charcount(str);
}
Nested structures#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct addr
{ int houseno;
char area[25];
char city[25];
char state[25];
};
struct emp
{
int empno;
char name[25];
char desig[25];
addr address;
float basic;
} worker;
int main ()
{ clrscr();
cout<<" n Enter employee number:"
cin>>worker.empno;
cout<<" n Enter name:"
gets(worker.name);
cout<<" n Enter Designation:"
gets(worker.desig);
cout<<" n Enter House no. :"
gets(worker.address.houseno);
cout<<" n Enter Area"
gets(worker.address.area);
cout<<" n Enter city
getsworker.address.city);
cout<<" n Enter state"
gets(worker.address.state);
cout<<" n Enter Basic pay "
cin>>worker.basic;
return0;
}
Student’s Result#include<iostream.h>
#include<conio.h>
#include<stdio.h>
struct student
{
int rollno;
char name[25];
float marks;
char grade;
};
student learner;
void main ()
{
clrscr();
cout<<" n Enter roll number:"
cin>>learner.rollno;
cout<<" n Enter name:"
gets(learner.name);
cout<<" n marks in 5 subjects:"
for (int i = 0;i < 5 ; ++i)
{
cout<<"Subject"<< i + 1 <<": ";
cin>>learner.marks[i];
}
float avg, total = 0;
for (int i = 0;i < 5 ; ++i)
total += sum[i];
avg = total/ 5;
if (avg < 50) learner.grade = 'F';
else if (avg < 60) learner.grade = 'C';
else if (avg < 80) learner.grade = 'B';
else lerner.grade = 'A'
cout<<" n Student's Result :"
cout<<" n roll number :"<<learner.rollno;
cout<<" n Name :'
puts(learner.name);
cout<<" n Total marks :"<< total;
cout<<" n Grade :"<<learner.grade <<endl;
}
cout<<" n Enter Basic pay "
cin>>worker.basic;
return 0;
}
Equality of strings
The later Date
#include<iostream.h>#include<iostream.h>
#include<conio.h>#include<conio.h>
#include<process.h>#include<process.h>
#include<stdio.h>#include<stdio.h>
date later( dateS1, dateS2);date later( dateS1, dateS2);
void main()void main()
{ clrscr();{ clrscr();
struct date { int day;struct date { int day;
int month;int month;
int year;int year;
}d1, d2;}d1, d2;
cout<<"enterfirst date";cout<<"enterfirst date";
cout<<"enterday";cout<<"enterday";
gets(d1.day);gets(d1.day);
cout<<"entermonth";cout<<"entermonth";
gets(d1.month);gets(d1.month);
cout<<"enteryear";cout<<"enteryear";
gets(d1.year);gets(d1.year);
cout<<"n";cout<<"n";
cout<<"entersecond date";cout<<"entersecond date";
cout<<"enterday";cout<<"enterday";
gets(d2.day);gets(d2.day);
cout<<"entermonth";cout<<"entermonth";
gets(d2.month);gets(d2.month);
cout<<"enteryear";cout<<"enteryear";
gets(d2.year);gets(d2.year);
date later(date S1, date S2)date later(date S1, date S2)
getch();getch();
}}
date later(date S1, date S2)date later(date S1, date S2)
{{
if (S2.year> S1.year)if (S2.year> S1.year)
cout<< S2;cout<< S2;
else if (S1.year> S2.year)else if (S1.year> S2.year)
cout<< S1;cout<< S1;
else if (S1.month > S2.month)else if (S1.month > S2.month)
cout<< S1;cout<< S1;
else if (S1.month < S2.month)else if (S1.month < S2.month)
cout<< S2;cout<< S2;
else if (S2.day > S1.day)else if (S2.day > S1.day)
cout<< S2;cout<< S2;
elseelse
cout<< S1;cout<< S1;
}}
CBSE Class XI Programming in C++

Más contenido relacionado

La actualidad más candente

18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator
SAFFI Ud Din Ahmad
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
TAlha MAlik
 

La actualidad más candente (20)

Diff between c and c++
Diff between c and c++Diff between c and c++
Diff between c and c++
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator
 
C++ functions presentation by DHEERAJ KATARIA
C++ functions presentation by DHEERAJ KATARIAC++ functions presentation by DHEERAJ KATARIA
C++ functions presentation by DHEERAJ KATARIA
 
Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programs
 
Programming Fundamentals Arrays and Strings
Programming Fundamentals   Arrays and Strings Programming Fundamentals   Arrays and Strings
Programming Fundamentals Arrays and Strings
 
Cs1123 3 c++ overview
Cs1123 3 c++ overviewCs1123 3 c++ overview
Cs1123 3 c++ overview
 
Introduction to c++
Introduction to c++Introduction to c++
Introduction to c++
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
 
C++ Functions
C++ FunctionsC++ Functions
C++ Functions
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
C++ functions
C++ functionsC++ functions
C++ functions
 
Advanced C - Part 2
Advanced C - Part 2Advanced C - Part 2
Advanced C - Part 2
 
C++ programming function
C++ programming functionC++ programming function
C++ programming function
 
C++ functions
C++ functionsC++ functions
C++ functions
 
Learning C++ - Functions in C++ 3
Learning C++ - Functions  in C++ 3Learning C++ - Functions  in C++ 3
Learning C++ - Functions in C++ 3
 
C++
C++C++
C++
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Function overloading(C++)
Function overloading(C++)Function overloading(C++)
Function overloading(C++)
 

Destacado

Overview of c++
Overview of c++Overview of c++
Overview of c++
geeeeeet
 

Destacado (11)

Multidimensional arrays in C++
Multidimensional arrays in C++Multidimensional arrays in C++
Multidimensional arrays in C++
 
Overview of c++
Overview of c++Overview of c++
Overview of c++
 
Understand Decision structures in c++ (cplusplus)
Understand Decision structures in c++ (cplusplus)Understand Decision structures in c++ (cplusplus)
Understand Decision structures in c++ (cplusplus)
 
Overview of c++ language
Overview of c++ language   Overview of c++ language
Overview of c++ language
 
Learn c++ Programming Language
Learn c++ Programming LanguageLearn c++ Programming Language
Learn c++ Programming Language
 
Revision notes for exam 2011 computer science with C++
Revision notes for exam 2011 computer science with C++Revision notes for exam 2011 computer science with C++
Revision notes for exam 2011 computer science with C++
 
Structure of C++ - R.D.Sivakumar
Structure of C++ - R.D.SivakumarStructure of C++ - R.D.Sivakumar
Structure of C++ - R.D.Sivakumar
 
Structure in c
Structure in cStructure in c
Structure in c
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ program
 
Arrays In C++
Arrays In C++Arrays In C++
Arrays In C++
 
CS101- Introduction to Computing- Lecture 26
CS101- Introduction to Computing- Lecture 26CS101- Introduction to Computing- Lecture 26
CS101- Introduction to Computing- Lecture 26
 

Similar a CBSE Class XI Programming in C++

Oops practical file
Oops practical fileOops practical file
Oops practical file
Ankit Dixit
 

Similar a CBSE Class XI Programming in C++ (20)

54602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee0108310154602399 c-examples-51-to-108-programe-ee01083101
54602399 c-examples-51-to-108-programe-ee01083101
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
2014 computer science_question_paper
2014 computer science_question_paper2014 computer science_question_paper
2014 computer science_question_paper
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
.net progrmming part2
.net progrmming part2.net progrmming part2
.net progrmming part2
 
Oops practical file
Oops practical fileOops practical file
Oops practical file
 
C++ file
C++ fileC++ file
C++ file
 
C++ file
C++ fileC++ file
C++ file
 
Bijender (1)
Bijender (1)Bijender (1)
Bijender (1)
 
Oops lab manual2
Oops lab manual2Oops lab manual2
Oops lab manual2
 
C++ practical
C++ practicalC++ practical
C++ practical
 
C++ file
C++ fileC++ file
C++ file
 
C++ TUTORIAL 5
C++ TUTORIAL 5C++ TUTORIAL 5
C++ TUTORIAL 5
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading2 BytesC++ course_2014_c3_ function basics&parameters and overloading
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output) Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)Practical Class 12th (c++programs+sql queries and output)
Practical Class 12th (c++programs+sql queries and output)
 
Include
IncludeInclude
Include
 
java experiments and programs
java experiments and programsjava experiments and programs
java experiments and programs
 

Más de Pranav Ghildiyal

CBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threadsCBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threads
Pranav Ghildiyal
 

Más de Pranav Ghildiyal (20)

Lasers
LasersLasers
Lasers
 
Global warming :- A PowerPoint Presentation
Global warming :- A PowerPoint PresentationGlobal warming :- A PowerPoint Presentation
Global warming :- A PowerPoint Presentation
 
A Report On Disaster Management
A Report On Disaster ManagementA Report On Disaster Management
A Report On Disaster Management
 
Recycle and reuse of everyday material
Recycle and reuse of everyday materialRecycle and reuse of everyday material
Recycle and reuse of everyday material
 
Word of the day (may)
Word of  the day (may)Word of  the day (may)
Word of the day (may)
 
Boost your knowledge
Boost your knowledgeBoost your knowledge
Boost your knowledge
 
CBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical fileCBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical file
 
CBSE Class XII physics practical project on Metal detector
CBSE Class XII physics practical project on Metal detectorCBSE Class XII physics practical project on Metal detector
CBSE Class XII physics practical project on Metal detector
 
CBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threadsCBSE Class XII practical project on Rayon threads
CBSE Class XII practical project on Rayon threads
 
Shopping mall
Shopping mallShopping mall
Shopping mall
 
CBSE Class X Rise of nationalism in europe
CBSE Class X Rise of nationalism in europeCBSE Class X Rise of nationalism in europe
CBSE Class X Rise of nationalism in europe
 
H1 n1 swine flu
H1 n1 swine fluH1 n1 swine flu
H1 n1 swine flu
 
CBSE Class IX Social Studies ECONOMICS Poverty as a challenge
CBSE Class IX Social Studies ECONOMICS Poverty as a challengeCBSE Class IX Social Studies ECONOMICS Poverty as a challenge
CBSE Class IX Social Studies ECONOMICS Poverty as a challenge
 
CBSE Class IX Sciense Physics Sound
CBSE Class IX Sciense Physics SoundCBSE Class IX Sciense Physics Sound
CBSE Class IX Sciense Physics Sound
 
CBSE Class IX Chemistry Natural resources
CBSE Class IX Chemistry Natural resourcesCBSE Class IX Chemistry Natural resources
CBSE Class IX Chemistry Natural resources
 
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pureCBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
 
CBSE Class X Chemical reactions and equations
CBSE Class X Chemical reactions and equationsCBSE Class X Chemical reactions and equations
CBSE Class X Chemical reactions and equations
 
CBSE Class XI Chemistry :- Organic chemistry (Basics)
CBSE Class XI Chemistry :- Organic chemistry (Basics)CBSE Class XI Chemistry :- Organic chemistry (Basics)
CBSE Class XI Chemistry :- Organic chemistry (Basics)
 
CBSE Class XI Maths Arthmetic progression
CBSE Class XI Maths Arthmetic progressionCBSE Class XI Maths Arthmetic progression
CBSE Class XI Maths Arthmetic progression
 
CBSE Class XI Maths Linear inequalities
CBSE Class XI Maths Linear inequalitiesCBSE Class XI Maths Linear inequalities
CBSE Class XI Maths Linear inequalities
 

Último

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Último (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

CBSE Class XI Programming in C++

  • 1.
  • 3. Sum Of MatricesSum Of Matrices
  • 4. Product Of Matrices cout<<"Enter second matrix rowcout<<"Enter second matrix row wise";wise"; for(i = 0; i<p; ++i)for(i = 0; i<p; ++i) for(j = 0; j<q; ++j)for(j = 0; j<q; ++j) cin>>B[i][j];cin>>B[i][j]; cout<<“product of the givencout<<“product of the given two matrix is : “;two matrix is : “; for(i = 0; i<m; ++i)for(i = 0; i<m; ++i) { cout<<“n”;{ cout<<“n”; for(j = 0; j<n; ++j)for(j = 0; j<n; ++j) { C[i][j] = 0;{ C[i][j] = 0; C[i][j] = C[i][j] + A[i][k] * B[k]C[i][j] = C[i][j] + A[i][k] * B[k] [j];[j]; cout<< C[i][j] << “ “;cout<< C[i][j] << “ “; }} }} }} elseelse cout<<“n the matrices are notcout<<“n the matrices are not compatible for multiplication “;compatible for multiplication “; getch();getch(); }}
  • 5.
  • 8. Stats of text #include<iostream.h> #include<conio.h> #include<process.h> void textstat( char str[], int &lc, int &wc, int &cc); void main() { clrscr(); char str[255] = “ Hi how are you !! ”; int lc, wc, cc; cout<<“n Enter any string (~ to terminate) : “; cin.getline(str, 255,’~’) textstat(str, lc, wc, cc); cout<< “number of lines in the string are: “<< lc; cout<< “number of words in the string are: “<< wc; cout<< “number of characters in the string are: “<< cc; getch(); } int wordcount(char str[]) { int count = 1; for (int i = 0; str[i] ‘0’; ++i) { if (str[i] == ‘i’ || str[i] == ‘n’) {count ++; while (str[i] ==‘ ‘) i++; } if (str[i]==‘0’) i--; } return count; } int charcount(char str[]) int count = 0; for (int i = 0; str[i] ‘0’; ++i) count++; return count; } int linecount(char str[]) { int count = 1; for (int i = 0; str[i] ‘0’; ++i) if(str[i]==‘n’) count++; return count; } void textstat( char str[], int &lc, int &wc, int &cc) { lc = linecount(str); wc = wordcount(str); cc = charcount(str); }
  • 9. Nested structures#include<iostream.h> #include<conio.h> #include<stdio.h> struct addr { int houseno; char area[25]; char city[25]; char state[25]; }; struct emp { int empno; char name[25]; char desig[25]; addr address; float basic; } worker; int main () { clrscr(); cout<<" n Enter employee number:" cin>>worker.empno; cout<<" n Enter name:" gets(worker.name); cout<<" n Enter Designation:" gets(worker.desig); cout<<" n Enter House no. :" gets(worker.address.houseno); cout<<" n Enter Area" gets(worker.address.area); cout<<" n Enter city getsworker.address.city); cout<<" n Enter state" gets(worker.address.state); cout<<" n Enter Basic pay " cin>>worker.basic; return0; }
  • 10. Student’s Result#include<iostream.h> #include<conio.h> #include<stdio.h> struct student { int rollno; char name[25]; float marks; char grade; }; student learner; void main () { clrscr(); cout<<" n Enter roll number:" cin>>learner.rollno; cout<<" n Enter name:" gets(learner.name); cout<<" n marks in 5 subjects:" for (int i = 0;i < 5 ; ++i) { cout<<"Subject"<< i + 1 <<": "; cin>>learner.marks[i]; } float avg, total = 0; for (int i = 0;i < 5 ; ++i) total += sum[i]; avg = total/ 5; if (avg < 50) learner.grade = 'F'; else if (avg < 60) learner.grade = 'C'; else if (avg < 80) learner.grade = 'B'; else lerner.grade = 'A' cout<<" n Student's Result :" cout<<" n roll number :"<<learner.rollno; cout<<" n Name :' puts(learner.name); cout<<" n Total marks :"<< total; cout<<" n Grade :"<<learner.grade <<endl; } cout<<" n Enter Basic pay " cin>>worker.basic; return 0; }
  • 12. The later Date #include<iostream.h>#include<iostream.h> #include<conio.h>#include<conio.h> #include<process.h>#include<process.h> #include<stdio.h>#include<stdio.h> date later( dateS1, dateS2);date later( dateS1, dateS2); void main()void main() { clrscr();{ clrscr(); struct date { int day;struct date { int day; int month;int month; int year;int year; }d1, d2;}d1, d2; cout<<"enterfirst date";cout<<"enterfirst date"; cout<<"enterday";cout<<"enterday"; gets(d1.day);gets(d1.day); cout<<"entermonth";cout<<"entermonth"; gets(d1.month);gets(d1.month); cout<<"enteryear";cout<<"enteryear"; gets(d1.year);gets(d1.year); cout<<"n";cout<<"n"; cout<<"entersecond date";cout<<"entersecond date"; cout<<"enterday";cout<<"enterday"; gets(d2.day);gets(d2.day); cout<<"entermonth";cout<<"entermonth"; gets(d2.month);gets(d2.month); cout<<"enteryear";cout<<"enteryear"; gets(d2.year);gets(d2.year); date later(date S1, date S2)date later(date S1, date S2) getch();getch(); }} date later(date S1, date S2)date later(date S1, date S2) {{ if (S2.year> S1.year)if (S2.year> S1.year) cout<< S2;cout<< S2; else if (S1.year> S2.year)else if (S1.year> S2.year) cout<< S1;cout<< S1; else if (S1.month > S2.month)else if (S1.month > S2.month) cout<< S1;cout<< S1; else if (S1.month < S2.month)else if (S1.month < S2.month) cout<< S2;cout<< S2; else if (S2.day > S1.day)else if (S2.day > S1.day) cout<< S2;cout<< S2; elseelse cout<< S1;cout<< S1; }}