Tuesday, December 15, 2020

17. Given two ordered arrays of integers, write a program to merge the two-arrays to get an ordered array.

 17. Given two ordered arrays of integers, write a program to merge the two-arrays to get an ordered array.




16. Write a menu driven program to perform following operations on strings: a) Show address of each character in string b) Concatenate two strings without using strcat function. c) Concatenate two strings using strcat function. d) Compare two strings e) Calculate length of the string (use pointers) f) Convert all lowercase characters to uppercase g) Convert all uppercase characters to lowercase h) Calculate number of vowels i) Reverse the string

 16. Write a menu driven program to perform following operations on strings: 

a) Show address of each character in string 

b) Concatenate two strings without using strcat function. 

c) Concatenate two strings using strcat function. 

d) Compare two strings 

e) Calculate length of the string (use pointers) 

f) Convert all lowercase characters to uppercase 

g) Convert all uppercase characters to lowercase 

h) Calculate number of vowels 

i) Reverse the string

15. Write a program to find sum of n elements entered by the user. To write this program, allocate memory dynamically using malloc() / calloc() functions or new operator.

 15. Write a program to find sum of n elements entered by the user. To write this program, allocate memory dynamically using malloc() / calloc() functions or new operator.




13. Write a program in which a function is passed address of two variables and then alter its contents.

 13. Write a program in which a function is passed address of two variables and then alter its contents.



14. Write a program which takes the radius of a circle as input from the user, passes it to another function that computes the area and the circumference of the circle and displays the value of area and circumference from the main() function.

 14. Write a program which takes the radius of a circle as input from the user, passes it to another function that computes the area and the circumference of the circle and displays the value of area and circumference from the main() function.





11. WAP that prints a table indicating the number of occurrences of each alphabet in the text entered as command line arguments.

 11. WAP that prints a table indicating the number of occurrences of each alphabet in the text entered as command line arguments.

how to execute from command line







c++ code :



12. Write a program that swaps two numbers using pointers.

 12. Write a program that swaps two numbers using pointers.



10. WAP to perform following actions on an array entered by the user: i.Print the even-valued elements ii.Print the odd-valued elements iii.Calculate and print the sum and average of the elements of array iv.Print the maximum and minimum element of array v.Remove the duplicates from the array vi.Print the array in reverse order The program should present a menu to the user and ask for one of the options. The menu should also include options to re-enter array and to quit the program.

 10. WAP to perform following actions on an array entered by the user:

 i.Print the even-valued elements 

ii.Print the odd-valued elements 

iii.Calculate and print the sum and average of the elements of array 

iv.Print the maximum and minimum element of array 

v.Remove the duplicates from the array 

vi.Print the array in reverse order 

The program should present a menu to the user and ask for one of the options. The menu should also include options to re-enter array and to quit the program.




Sunday, December 6, 2020

CMS-A-CC-5-11-P: Relational Database Management System

 CMS-A-CC-5-11-P: Relational Database Management System

Core Course- 11, Practical, Credit:02, Contact hours: 40 hours.

RDBMS Lab using My SQL & PHP

11WAP to calculate factorial and to compute the factors of a given no. (i)using recursion, (ii) using iteration



11. WAP to calculate factorial and to compute the factors of a given no. (i)using recursion, (ii) using iteration

#include<iostream>

using namespace std;


class cl

{

private:

int no,fl;

public:

void input()

{

fl=1;

cout<<"\nEnter the no: ";

cin>>no;

}

void factorial()

{


if(no==0)

{

cout<<"\n"<<no<<"!= "<<1;

}

else

{

for(int i=no;i>=1;i--)

{

fl=fl*i;

}

cout<<"\n"<<no<<"!= "<<fl;

}

}

int factorial(int n)

{

if(n > 1)

return n * factorial(n - 1);

else

return 1;

}

void factor()

{

cout<<"\nFactors of "<<no<<"= ";

if(no==1)

{

cout<<1;

}

for(int i=2;i<=no;i++)

{

if(no % i ==0)

{

cout<<" "<<i;


}

}

}

void factor(int n,int i)

{

if(n==1)

cout<<"1";

else

{

if(i <= n)

{

if(n%i == 0)

{

cout << i << " ";

}

factor(n,i+1);

}

}

}

};

int main()

{

cl ob;

int ch,n,x;


do

{

    cout<<"\n1.FACTORIAL using Iteration \n2.FACTORIAL using Recursion \n3.Compute FACTORS using Iteration \n4.Compute FACTORS using Recursion \n5.Exit";

cout<<"\nEnter ur Choice: ";

cin>>ch;

switch(ch)

{

case 1:


ob.input();

ob.factorial();

break;


case 2:

cout<<"\nEnter the no: ";

cin>>n;

x=ob.factorial(n);

cout<<"\n"<<n<<"!= "<<x;

break;


case 3:

ob.input();

ob.factor();

break;


case 4:

cout<<"\nEnter the no: ";

cin>>n;

cout<<"\nFactors of "<<n<<"= ";

ob.factor(n,2);

break;


case 5:

cout<<"\nEXIT";

break;


default:

cout<<"\nSorry! Invalid Choice";

}

}

while(ch!=5);


return 0;

}