beingtopper.jkp@gmail.com
+91-8700702530
Free Demo

Being Topper

  • About Us
  • Knowledge Base
  • Modules
  • Branches
    • Ajmer
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us

Being Topper

  • About Us
  • Knowledge Base
  • Modules
  • Branches
    • Ajmer
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us
  • About Us
  • Knowledge Base
  • Modules
  • Branches
    • Ajmer
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us

Being Topper

  • About Us
  • Knowledge Base
  • Modules
  • Branches
    • Ajmer
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us
Algorithm Design and analysis ProgramsB.tech notesC++ programInformation technology

C++ PROGRAM FOR ACTIVITY SELECTOR

Being Topper 25/05/2013 0 Comments

  WRITE A PROGRAM FOR ACTIVITY SELECTOR

 

#include<iostream.h>
 #include<conio.h>
 void main()
 {int act[3][7],i,j,temp,start,a[7],k=1,min;
 clrscr();
 for(i=0;i<7;i++)
 a[i]=0;
 for(i=0;i<7;i++)
 act[0][i]=i+1;
 for(j=0;j<7;j++)
 {cout<<"\nEnter the starting time of "<<j+1<<" activity:";
 cin>>act[1][j];
 cout<<"Enter the finishing time of "<<j+1<<" activity:";
 cin>>act[2][j];
 }
 for(i=0;i<7;i++)
 {min=act[2][i];
 start=act[1][i];
 temp=i;
 for(j=i+1;j<7;j++)
 {if(act[2][j]<min)
 {min=act[2][j];
 start=act[1][j];
 temp=j;
 }
 }
 act[2][temp]=act[2][i];
 act[1][temp]=act[1][i];
 act[2][i]=min;
 act[1][i]=start;
 }

a[0]=1;
 i=0;
 for(int m=1;m<7;m++)
 {if(act[1][m]>=act[2][i])
 {a[k]=m+1;
 k++;
 i=m;
 }
 }
 cout<<"\The activities that can be performed is:";
 for(i=0;a[i]!=0;i++)
 cout<<a[i]<<" ";
 getch();
 }
C++ PROGRAM FOR ACTIVITY SELECTOR WITH OUTPUT ..


C++-PROGRAM-FOR-ACTIVITY-SELECTOR

 

Algorithm and design analysis C++ PROGRAM FOR ACTIVITY SELECTOR WITH OUTPUT SCREEN c++ programs
AboutBeing Topper
In Socials:
PrevC++ PROGRAM ON QUICK SORT24/05/2013
C++ program to perform robin karp string matching25/05/2013Next

Related Posts

AppletB.tech notesBCA NOTESInformation technologyJava ProgramsPrograms/Algorithm

Example of an applet program in java

Introduction to An Applet program in Java Before Jumping Straight to Writing an Applet...

Being Topper 18/02/2014
B.tech notesBCA NOTESEvent HandlingInformation technologyJava Programs

Java program for event Handelling

Java program for event Handelling import java.awt.*; import java.awt.event.*; class...

Being Topper 17/03/2014
Categories
Recent Posts
  • Best Email Marketing Software and Services
  • How to Apply Adsense on YouTube
  • Complete Guide to Writing a Newsletter !
  • Benefits of Creating Email List for small Businesses | Digital Marketing
  • Create Account or Get Email Alerts When New Employees Join a Company

Copyright © 2021 Being Topper ® . All Rights Reserved