SlideShare a Scribd company logo
CBSE Class XI Programming in C++
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();
}}
CBSE Class XI Programming in C++
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++

More Related Content

PPT
C++ Overview
PPTX
C introduction by thooyavan
PPT
Advanced Programming C++
PPTX
C++ presentation
PDF
C++ book
PPTX
C++ language basic
PPTX
C++ Overview PPT
C++ Overview
C introduction by thooyavan
Advanced Programming C++
C++ presentation
C++ book
C++ language basic
C++ Overview PPT

What's hot (20)

DOCX
Diff between c and c++
PPTX
Introduction to c++
DOCX
18 dec pointers and scope resolution operator
PPT
C++ functions presentation by DHEERAJ KATARIA
PPTX
Basic c++ programs
PDF
Programming Fundamentals Arrays and Strings
PPTX
Cs1123 3 c++ overview
PPTX
Introduction to c++
PDF
Introduction to cpp
PPT
C++ Functions
PPTX
Introduction to C++
PPT
C++ functions
PPTX
C++ programming function
PPT
C++ functions
PPTX
Learning C++ - Functions in C++ 3
PDF
PPT
C++ Language
PDF
Functions in C++
PPT
Function overloading(C++)
Diff between c and c++
Introduction to c++
18 dec pointers and scope resolution operator
C++ functions presentation by DHEERAJ KATARIA
Basic c++ programs
Programming Fundamentals Arrays and Strings
Cs1123 3 c++ overview
Introduction to c++
Introduction to cpp
C++ Functions
Introduction to C++
C++ functions
C++ programming function
C++ functions
Learning C++ - Functions in C++ 3
C++ Language
Functions in C++
Function overloading(C++)
Ad

Viewers also liked (11)

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

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

PDF
54602399 c-examples-51-to-108-programe-ee01083101
DOC
Pads lab manual final
PDF
Cryptography and network security record for cse .pdf
DOCX
Cs pritical file
PPTX
oops practical file.pptx IT IS A PRACTICAL FILE
PDF
2014 computer science_question_paper
DOCX
12th CBSE Practical File
DOCX
.net progrmming part2
PDF
C++ normal assignments by maharshi_jd.pdf
DOCX
Oops practical file
DOCX
C++ file
DOCX
C++ file
DOCX
Bijender (1)
DOC
Oops lab manual2
PDF
C++ practical
DOCX
PDF
C++ TUTORIAL 5
PDF
C++ ARRAY WITH EXAMPLES
PDF
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
DOC
Practical Class 12th (c++programs+sql queries and output)
54602399 c-examples-51-to-108-programe-ee01083101
Pads lab manual final
Cryptography and network security record for cse .pdf
Cs pritical file
oops practical file.pptx IT IS A PRACTICAL FILE
2014 computer science_question_paper
12th CBSE Practical File
.net progrmming part2
C++ normal assignments by maharshi_jd.pdf
Oops practical file
C++ file
C++ file
Bijender (1)
Oops lab manual2
C++ practical
C++ TUTORIAL 5
C++ ARRAY WITH EXAMPLES
2 BytesC++ course_2014_c3_ function basics&parameters and overloading
Practical Class 12th (c++programs+sql queries and output)

More from Pranav Ghildiyal (20)

DOC
PPT
Global warming :- A PowerPoint Presentation
DOC
A Report On Disaster Management
PPSX
Recycle and reuse of everyday material
PPT
Word of the day (may)
PPT
Boost your knowledge
DOC
CBSE Class XII Comp sc practical file
DOC
CBSE Class XII physics practical project on Metal detector
DOC
CBSE Class XII practical project on Rayon threads
DOC
Shopping mall
DOC
CBSE Class X Rise of nationalism in europe
DOCX
H1 n1 swine flu
PPTX
CBSE Class IX Social Studies ECONOMICS Poverty as a challenge
PPTX
CBSE Class IX Sciense Physics Sound
PPTX
CBSE Class IX Chemistry Natural resources
PPTX
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
PPT
CBSE Class X Chemical reactions and equations
PPT
CBSE Class XI Chemistry :- Organic chemistry (Basics)
PPT
CBSE Class XI Maths Arthmetic progression
PPT
CBSE Class XI Maths Linear inequalities
Global warming :- A PowerPoint Presentation
A Report On Disaster Management
Recycle and reuse of everyday material
Word of the day (may)
Boost your knowledge
CBSE Class XII Comp sc practical file
CBSE Class XII physics practical project on Metal detector
CBSE Class XII practical project on Rayon threads
Shopping mall
CBSE Class X Rise of nationalism in europe
H1 n1 swine flu
CBSE Class IX Social Studies ECONOMICS Poverty as a challenge
CBSE Class IX Sciense Physics Sound
CBSE Class IX Chemistry Natural resources
CBSE Class IX SCIENCE CHEMISTRY Is matter around us pure
CBSE Class X Chemical reactions and equations
CBSE Class XI Chemistry :- Organic chemistry (Basics)
CBSE Class XI Maths Arthmetic progression
CBSE Class XI Maths Linear inequalities

Recently uploaded (20)

PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
master seminar digital applications in india
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Yogi Goddess Pres Conference Studio Updates
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Lesson notes of climatology university.
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
UNIT III MENTAL HEALTH NURSING ASSESSMENT
STATICS OF THE RIGID BODIES Hibbelers.pdf
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
202450812 BayCHI UCSC-SV 20250812 v17.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Paper A Mock Exam 9_ Attempt review.pdf.
master seminar digital applications in india
Final Presentation General Medicine 03-08-2024.pptx
Weekly quiz Compilation Jan -July 25.pdf
Radiologic_Anatomy_of_the_Brachial_plexus [final].pptx
Anesthesia in Laparoscopic Surgery in India
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
2.FourierTransform-ShortQuestionswithAnswers.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Yogi Goddess Pres Conference Studio Updates
Chinmaya Tiranga quiz Grand Finale.pdf
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Lesson notes of climatology university.
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf

CBSE Class XI Programming in C++

  • 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(); }}
  • 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; }}