Tag Archives: Write

CPP05 – Write a CPP program to create Student class with appropriate constructor and destructor

Write a CPP program to create Student class with appropriate constructor and destructor. Also show what happen when you try to attempt to access private data members from outside of the class. CODE:- #include<iostream.h> #include<string.h> #include<conio.h> class student { int roll; char name[25]; char addr[100]; int std; char div; long cont; public: void get_data(int,char*,char*,int,char,long); void… Read More »

CPP04 – (c) Write a CPP program to generate a Fibonacci series of 50 numbers .

(c) Write a CPP program to generate a Fibonacci series of 50 numbers . CODE:- #include<iostream.h> #include<conio.h> void main() { unsigned long T,i,X=0,Y=1; clrscr(); cout<<“\nFIBONACCI 50 SERIES ARE :- \n”; i=0; while(i<50) { T=X+Y; cout<<” “<<X; X=Y; Y=T; i++; } getch(); } SCREEN SHOTS:- OUTPUT:-  

CPP04 – (b) Write a CPP program to print whether a number is prime or not .

(b) Write a CPP program to print whether a number is prime or not . CODE:- #include<iostream.h> #include<conio.h> void main() { int NUM,I; clrscr(); cout<<“ENTER A NUMBER :”; cin>>NUM; for(I=2;I<NUM;I++) { if(NUM%I==0) break; } if(I==NUM) cout<<NUM<<” IS A PRIME NUMBER”<<endl; else cout<<NUM<<” IS NOT A PRIME NUMBER”<<endl; getch(); } SCREEN SHOTS:- OUTPUT:-  

CPP04 – (a) Write a CPP program to print the factorial of a given number.

(a) Write a CPP program to print the factorial of a given number. CODE:- #include<iostream.h> #include<conio.h> void main() { int i,num; long fact=1; clrscr(); cout<<“Enter Number : “; cin>>num; for(i=num;i>0;i–) { fact=fact*i; } cout<<“Factorial = “<<fact<<endl; getch(); } SCREEN SHOTS:- OUTPUT:-  

CPP02 – Write a CPP program to explain the use of for loop, while loop, switch-case, break and continue statements.

CPP02 – Write a C++ program to explain the use of for loop, while loop, switch-case, break and continue statements. CODE:- #include<iostream.h> #include<conio.h> void main() { int i; clrscr(); cout<<“FOR LOOP”<<endl; for(i=1;i<6;i++) cout<<i<<endl; cout<<“WHILE LOOP”<<endl; while(i>1) cout<<–i<<endl; cout<<“DO WHILE LOOP”<<endl; do { cout<<i++<<endl; }while(i<6); getch(); } SCREEN SHOTS:- OUTPUT:-   CODE:- #include<iostream.h> #include<conio.h> void main()… Read More »

CPP01- Write a CPP program to find size and print the all basic data types of C++.

Write a CPP program to find size and print the all basic data types of C++. CODE:- #include<iostream.h> #include<conio.h> void main() { char c=’c’; int i=123; short s=12; long l=98775345; float f=456.789; double d=12345.6789; clrscr(); cout << “Value of char   : ” << c << endl; cout << “Value of int    : ” << i… Read More »

HTML03 Write an HTML code to design a page containing text, in form of paragraphs giving suitable heading style.

Write an HTML code to design a page containing text, in form of paragraphs giving suitable heading style. Write an HTML code to design a page containing text, in form of paragraphs giving suitable heading style. Html code: Write above code in any text editor and save by htm or html extension and Open it… Read More »

HTML01 Write HTML code to develop a Web page having the background in red and title “My First Page” in any other colour

Write HTML code to develop a Web page having the background in red and title “My First Page” in any other colour. HTML stands for HyperText Markup Language. HTML provides a way of displaying Web pages with text and images or multimedia content. HTML is not a programming language, but a markup language. An HTML… Read More »