10/11/2017

BCS1223 Data Structure And Algorithms

#include
#include
using namespace std;
#define SIZE 5
int q[SIZE],front=0,rear=0;

void enqueue()
{
   int no;
   if (rear==SIZE && front==0)
      cout<<"queue is full";
   else
   {
      cout<<"enter the num:";
      cin>>no;
      q[rear]=no;
   }
   rear++;
}

void dequeue()
{
   int no,i;
   if (front==rear)
   cout<<"queue is empty";
   else
   {
      no=q[front];
      front++;
      cout<<"\n"<   }
}

void display()
{
   int i,temp=front;
   if (front==rear)
   cout<<"the queue is empty";
   else
   {
      cout<<"\n element in the queue:";
      for(i=temp;i       {
          cout<       }
   }
}

int main(int argc, char *argv[])
{
   int ch;
   //clrscr();
   while(1)
   {
      cout<<"\n 1.add element";
      cout<<"\n 2.remove element";
      cout<<"\n 3.display";
      cout<<"\n 4.exit";
      cout<<"\n enter your choice:";
      cin>>ch;
      //clrscr();
      switch(ch)
      {
        case 1:
        enqueue();
        break;
        case 2:
        dequeue();
        break;
        case 3:
        display();
        break;
        case 4:
        exit(0);
        default:
        cout<<"\n invalid choice";
      }//switch
   }//while
 
    system("PAUSE");
    return EXIT_SUCCESS;
}

DCT1144 Programming Fundamentals LAB 11 Sept 2017

Write a program to process a collection of daily high temperatures. Your program should count and print the number of hot days (high temperature 85 or higher), the number of pleasant days (high temperature 60-84), and the number of cold days (high temperatures less than 60). It should also display the category of each temperature. Test your program on the following data:
55 62 68 74 59 45 41 58 60 67 65 78 82 88 91 92 90 93 87 80 78 79 72 68 61 59

10/08/2017

DCT1144 Programming Fundamentals LAB 9 Sept 2017

1. Print the following output using a C++ program


5   4   3   2   1
5   4   3   2   1
5   4   3   2   1
5   4   3   2   1

2. Print the following output using a C++ program

1
1   2
1   2   3
1   2   3   4
1   2   3   4   5


3.  Print the following output using a C++ program






4. Print the following output using a C++ program


5.Print the following output using a C++ program

 6. Print the following output using a C++ program










10/02/2017

DCT1144 Programming Fundamentals : Assignment 1


1. Write an algorithm and a C++  program that will calculate and print bills for the city power company. The rates vary depending on wheather the use is residential or commercial. A code R means residental use and  a code of C means commeercial use. Any other code should be treated as an error.
The rates are computes as follows:

R: RM5.00 Plus RM0.31 per KWH used
C: RM50.00 for the first 1000KWH and RM0.45 for each additional KWH.

Your program should prompt the user to enter an integer account number, the use code (type char), and the necessary consumption figures in whole numbers of kilowatt-hours. Your program should display the amount due for the user.


2. Write an algorithm and a C++ program that prompts the user to enter the number of students and each student's id and score, and finally displays the student with the highest score.

BCS1223 Data Structure And Algorithms

#include #include using namespace std; #define SIZE 5 int q[SIZE],front=0,rear=0; void enqueue() {    int no;    if (rear==SIZE && f...