CBSE Class XI Programming in C++
Upcoming SlideShare
Loading in...5
×
 

CBSE Class XI Programming in C++

on

  • 538 views

CBSE Class XI Programming in C++

CBSE Class XI Programming in C++

Statistics

Views

Total Views
538
Views on SlideShare
538
Embed Views
0

Actions

Likes
0
Downloads
34
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    CBSE Class XI Programming in C++ CBSE Class XI Programming in C++ Presentation Transcript

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