Thursday, December 26, 2019

Solar System animation in c++ programming language using openGL api and glut and glew as utility


Solar System animation in C++



code:


Sorting of array in ascending order in 8085 assembly language


Sorting of array in 8085



Description:

Here all the array input is provided through address shown in simulator.



code:


Addition of upper and lower nibble of a 8 bit number in 8085 assembly language

Addition of upper and lower nibble of a 8 bit number 


code:




Addition of two 8 bit number in 8085 microprocessor assembly language


Addition of two 8 bit number


code


How to make Virtual Guitar in C++ programming language

Virtual Guitar

Audio file used in the project can be download through link below along with complete project:

Download here:





code

How to make Maze in 2d using C programming language using concept of Data structure and Algorithm

MAZE Generator




ALGORITHM


  1.  Start
  2. Declaration of all the necessary variable.
  3. Display initial message to user to perform some task.
  4. Depending upon the user input perform task as below:

a)    if userInput == 1 then draw maze.
                                                                             i.          Take length and width of maze from user.
                                                                           ii.          Allocate memory segment for all maze dynamically.
                                                                         iii.          Set boundary  with “#” character.
                                                                         iv.           Link inner node with each other.
                                                                           v.          Check whether destination is wall or not.if not make it blank.
                                                                         vi.          Draw character of each node to generate maze.
b)    else if userInput == 2 then terminate  the program.
c)     else goto step 3.


  1.  Handle  all necessary exception.
  2.   stop.



      CODE




























Saturday, January 12, 2019

program to find prime number in c plus plus using object oriented concept

Code:


#include"pch.h"
#include<iostream>
#include<conio.h>

 using namespace std;

  class prime
  {
  public:
  void getdata(void);
  void showdata(void);
  void checkprime(void);
  private:
  int number, i, flag = 1;
  };


  void prime::getdata(void)
  {
  cout << "Enter number which is to check : ";
  cin >> number;

  }

  void prime::showdata(void)
  {
  if (flag)
  {
  cout << "Entered number is prime .";

  }
  else
  {

  cout << "Entered number is not prime";
  }

  }

  void prime::checkprime(void)
  {
  if (number == 2)
  {
  cout << "Entered number is prime ";
  }
  else if (number > 2)
  {
  for (i = 2; i <= (number / 2); i++) {
  if (number%i == 0) {
  flag = 0;
  break;
  }
  }
  }
  else
  {
  cout << " Enter valid positive number greater then 1 !!!";
  }
  }



int main() {

prime p;
p.getdata();
p.checkprime();
p.showdata();

return(0);
}




Output :






program to find prime number using procedural pattern in c plus plus

Question: Program to find prime number.


Solution:
#include"pch.h"
#include<iostream>
#include<conio.h>

  using namespace std;

int main() {
int n,i;
int flag = 1;
cout << "Enter number which is to check : ";
cin >> n;
if (n==2)
{
cout << "Entered number is prime ";
}
else if (n >2 ) 
{
for (i = 2; i <= (n/2); i++) {
if (n%i==0) {
flag = 0;
break;
}

}

if (flag)
{
cout << "Entered number is prime .";

}
else
{

cout << "Entered number is not prime";
}

}
else
{
cout << " Enter valid positive number greater then 1 !!!";
}

return(0);

}



Output:





C plus plus example

Question :  Write a program to create class "time"  with data members hours,minute and second ,then add two "time" objects by taking as argument and also returning object as an argument.

Solution :


#include"pch.h"
#include<iostream>
#include<conio.h>

class time
{
public:
time();
~time();
void setData();
void display();
time addTime( time);

private:
int hour, minute, second;

};

time::time()
{
hour = 0;
minute = 0;
second = 0;
}

time::~time()
{

}

void time::setData()
{
std::cout << "Enter Hour : ";
std::cin >> hour;
std::cout << "Enter Minute : ";
std::cin >> minute;
std::cout << "Enter Second : ";
std::cin >> second;
}

void time::display()
{
std::cout << "\nHour = " << hour << "\tMinute = " << minute << "\tSecond = " << second;
}

time time::addTime( time t2)
{
time temp;
temp.hour = hour + t2.hour;
temp.minute = minute + t2.minute;
temp.second = second + t2.second;
return time(temp);
}



int main() {

time t1, t2, t3;
t1.setData();
t2.setData();
t3 = t1.addTime(t2);
t3.display();
return(0);

}



Output: