Posts

Ds

 [9/17, 8:38 AM] Rudresh Engg: #include <stdio.h> #include <string.h> // Structure definition for storing student details struct Student {     int id;              // Student ID     char name[50];       // Student name     int age;             // Student age     char address[100];   // Student address }; int main() {     int n, i;     // Ask user for number of students     printf("Enter number of students: ");     scanf("%d", &n);     // Create an array of Student structures     struct Student students[n];     // Input student details     for(i = 0; i < n; i++) {         printf("\nEnter details of student %d:\n", i+1);         printf("ID: ");         scanf("%d", &students[i].id); ...

Usp

 5. Write awk script that uses all of its features. #!/bin/awk -f BEGIN {print “START”} {print $1, “\t”, $3} END {print “DONE”} output:  [LabExam@ISELAB1 ~]$ awk -f pr5.awk a.txt And am You can Me you LabExam@ISELAB1 ~]$ cat a.txt And is am I was You they can take Me as you print 6. Write a shell script to display list of users currently logged in. #!/bin/sh echo “User logged in:” users echo “Current logged in date and time :” date echo “Currently logged in users:” who echo “Currently logged in username:” whoami output:  [LabExam@ISELAB1 ~]$ sh pr6.sh [LabExam@ISELAB1 ~]$chmod a+x pr6.sh [LabExam@ISELAB1 ~]$sh pr6.sh User logged in: UNIX LAB UNIX LAB Current logged in date and time: Sat sep 29 12:25:30 IST 2018-11-22 Currently logged in users: UNIXLAB TTY1 2018-09-29 11.08 (:0) UNIXLAB pts/0 2018-09-29 12.03 (:0.0) UNIXLAB pts/1 2018-09-29 12.28 (:0.0) Currently logged in username: UNIXLAB PART B 1. Write a C/C++ program to implement the cat command using general fi...

ds lab

  1. Write a C Program to construct a stack of integers and to perform the following operations on it:         a. Push b.   Pop c.    Display   The program should print appropriate messages for stack overflow, stack underflow and stack          empty.     #include<stdio.h> #include<conio.h> #include<process.h> #define MAX_SIZE 4   int s[MAX_SIZE],top=-1;   void main() { void PUSH(int); void POP(); void DISPLAY(); int ch,x;   while(1)   {   clrscr();   printf("\n enter your choice \n\n 1.PUSH \n 2.POP \n 3.DISPLAY \n 4.EXIT \n\n");   scanf("%d",&ch);   switch(ch)   {             case 1: printf("\n enter the element to be inserted \n");                   ...