0% found this document useful (0 votes)
8 views

C++ Prog

A program using inline function to find the largest of three numbers in c++ Can You Write A Program To Read Matrix M n On The Keyboard And Display The Same?

Uploaded by

Sree Hari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

C++ Prog

A program using inline function to find the largest of three numbers in c++ Can You Write A Program To Read Matrix M n On The Keyboard And Display The Same?

Uploaded by

Sree Hari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <iostream.

h>
#include <conio.h>
void main()
{
double power(double m,int n=2);
clrscr();
cout<<endl<<endl<<endl;
int choice,m,n;
double result;
do
{
cout<<"\n\n\nCHOICES\n\n";
cout<<"1)    Only Value of M\n";
cout<<"2)    Value for both M and N\n";
cout<<"3)    QUIT\n";
cout<<"ENTER YOUR CHOICE:-";
cin>>choice;
clrscr();
cout<<endl<<endl<<endl;
switch(choice)
{
    case 1 : cout<<"Enter Value for M:-";
               cin>>m;
            result=power(m);
            cout<<"Power function when default argument is used ="<<result;
            break;
   case 2 : cout<<"Enter Value for M and N:-";
               cin>>m>>n;
            result=power(m,n);
            cout<<"Power function when actual argument is use ="<<result;
            break;
   case 3 : gotoout;
   default: cout<<"Entered Value is Invalid, Try again";
}
}while(choice!=3);
out:
}
a program using inline function to find the largest of three numbers in c++

#include<iostream.h>
inline void large(int a,int b,int c)
{
if(a>b)
{
if(a>c)
{
cout<<”a is greatest”;
}
else
{
cout<<”c is greatest”;
}
}
else
{
if(b>c)
{
cout<<”b is greatest”;
}
else
{
cout<<”C is greatest”;
}
}
}
void main()
{
int a,b,c;
cin>>a;
cin>>b;
cin>>c;
large(a,b,c);
}
Can You Write A Program To Read Matrix M*n On The Keyboard And Display
The Same?
#include<conio.h>
#include<stdio.h>
void main()
{
int a[10][10],m,n,i,j;
clrscr();
printf("Enter the number of rows in the matrix:");
scanf("%d",&m);
printf("Enter the number of columns in the matrix:");
scanf("%d",&n);
for(i=0;i<m;i++)
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
printf("The matrix is as follows");
for(i=0;i<m;i++)
{

for(j=0;j<n;j++) printf("%d ",a[i][j]);


printf("/n");
}
getch();
}

You might also like