Posts

Showing posts from May, 2022

interface in Java by lakshmanse

interface Intfac{    void see(); } class One implements Intfac{   public void wish(){     System.out.println("Hello users 👋"); } public void see(){   System.out.println("Hello users Can you 🙈 See"); } } class Main extends One {   public static void main(String[] args) {     System.out.println("Hello world!"); One obj = new One(); obj.wish(); obj.see();      } }

Microsoft hiring process explained

Image

who does what ? [ what is the difference between software developer and full stack developer]>>>

Image

A very big sum (long long int sum )

#include <iostream> using namespace std; int main() { int n; long long int sum=0; cin >> n; vector<int> arr(n); for(int arr_i = 0;arr_i < n;arr_i++) { cin >> arr[arr_i]; sum+=arr[arr_i]; } cout<<sum; return 0; }

C++ Program For HANGMAN ( GAME PROJECT )

#include <iostream> #include <cstdlib> #include<ctime> #include <string> using namespace std; const int MAX_TRIES=5; int letterFill (char, string, string&); int main () {  string name;  char letter;  int num_of_wrong_guesses=0;  string word;  string words[] =  {  "india",  "pakistan",  "nepal",  "malaysia",  "philippines",  "australia",  "iran",  "ethiopia",  "oman",  "indonesia"  };  //choose and copy a word from array of words randomly  srand(time(NULL));  int n=rand()% 10;  word=words[n];  // Initialize the secret word with the * character.  string unknown(word.length(),'*');  // welcome the user  cout << "\n\nWelcome to hangman...Guess a country Name";  cout << "\n\nEach letter is represented by a star."; cout << "\n\nYou have to type only one letter in one try"; cout << "\n\nYou have ...

tic tac toe game in cpp

#include <iostream> using namespace std; char CharMatrixDraw[10] = {'0','1','2',        '3','4','5',        '6','7','8','9'}; int winner(); void GameChart(string,string); This program is divided into 3 Parts read a Full Article for understanding full code 1.GameChart draw. 2.Changing the Value of GameChart. 3.Check Win. */ int main() {   int Gamer = 1, i, choice;  string name1;  string name2;  cout<<"Enter First Gamer Name: ";  cin>>name1;  cout<<"\nEnter Second Gamer Name: ";  cin>>name2; char mark;      do   {     GameChart(name1,name2);     Gamer=(Gamer%2)?1:2;    if (Gamer==1)  {   cout <<name1<< " Your Turn, Enter a Number: ";     cin >> choice;  }  else  {   cout <<name2 << " Your Turn, Enter a Number: ";     cin >> choice;  } /* Part 2 ...

student management system project 2

#include<iostream> #include<string> #include<conio.h> #include<stdlib.h> using namespace std; int main(); void show_data(int searchkey); //function used to show data to end-user. void get_data(int i); //function used to obtain data from end-user. void search_student(int searchkey); void add_student(); //This function is used to add record of new student. void edit_student(int idnumber); //function is used to edit existing record.    void fullscreen(); int ts; struct student     //Structure student is made to store student attributes. {    int rollno;    string name;   string fname;   string cell;   string dob;   string address; }; student rec[50]; //This is basic array of defined structure to sore data. int main() {   system("CLS");   system("color B1");   int choice; //int variable used to determine which operation user want to do.   int idnumber; //int vari...

250+ C Programs for Practice

250+ C Programs for Practice PDF Free Download 1. Simple C Questions ● Area and Circumference of a Circle ● Print Ascii Value of the Character ● Area of Triangle ● Convert a Person’s Name in Abbreviated ● Simple Interest ● Gross Salary of an Employee ● Percentage of 5 Subjects ● Converting Temperature Celsius into Fahrenheit ● The Display Size of the Different Data Type ● Factorial of a Given Number ● Read Integer (N) and Print the First Three Powers (N^1, N^2, N^3) ● Area of a Circle ● LCM of Two Numbers ● GCD of Two Numbers 2. If/Else Statement ● The Greatest Number Among the Given Three Number ● The Number Is Positive or Negative ● Character Is Vowel or Consonant ● A Character Is an Alphabet or Not ● Uppercase, Lowercase, Special Character, or Digit ● The Number Is Positive or Negative ● The Number Is Even or Odd ● Greatest of Two Numbers ● Greatest Among Three Numbers ● Leap Year ● The Date Is Correct or Not ● Voting Eligibility Checker ● Find the maximum between two numbers. ● Fin...

merge short implementation in c imp

#include <stdio.h>      /* Function to merge the subarrays of a[] */   void merge(int a[], int beg, int mid, int end)     {         int i, j, k;       int n1 = mid - beg + 1;         int n2 = end - mid;                int LeftArray[n1], RightArray[n2]; //temporary arrays              /* copy data to temp arrays */       for (int i = 0; i < n1; i++)         LeftArray[i] = a[beg + i];         for (int j = 0; j < n2; j++)         RightArray[j] = a[mid + 1 + j];                i = 0; /* initial index of first sub-array */       j = 0; /* initial index of second sub-array */        k = beg; /* initial inde...

merge short in c language by lakshman

//Merge short implementation in c void mergeSort(int arr[], int l, int r) { if (l < r) { // Finding mid element int m = l+(r-l)/2; // Recursively sorting both the halves mergeSort(arr, l, m); mergeSort(arr, m+1, r); // Merge the array merge(arr, l, m, r); } } void merge(int arr[], int l, int m, int r) { int i, j, k; int n1 = m - l + 1; int n2 = r - m; // Create temp arrays int L[n1], R[n2]; // Copy data to temp array for (i = 0; i < n1; i++) L[i] = arr[l + i]; for (j = 0; j < n2; j++) R[j] = arr[m + 1+ j]; // Merge the temp arrays i = 0; j = 0; k = l; while (i < n1 && j < n2) { if (L[i] <= R[j]) { arr[k] = L[i]; i++; } else { arr[k] = R[j]; j++; } k++; } // Copy the remaining elements of L[] while (i < n1) { arr[k] = L[i]; i++; k++; } // Copy the remaining elements of R[] while (j < n2) { arr[k] = R[j]; j++; k++; } } #include<stdlib.h> #include<stdio.h> // Merge Function void merge(int arr[], int l, int m, int r) { int i, j, k; int n1 = m - l...

Hash table in c implementation

// Implementing hash table in C #include <stdio.h> #include <stdlib.h> struct set {   int key;   int data; }; struct set *array; int capacity = 10; int size = 0; int hashFunction(int key) {   return (key % capacity); } int checkPrime(int n) {   int i;   if (n == 1 || n == 0)   {   return 0;   }   for (i = 2; i < n / 2; i++)   {   if (n % i == 0)   {     return 0;   }   }   return 1; } int getPrime(int n) {   if (n % 2 == 0)   {   n++;   }   while (!checkPrime(n))   {   n += 2;   }   return n; } void init_array() {   capacity = getPrime(capacity);   array = (struct set *)malloc(capacity * sizeof(struct set));   for (int i = 0; i < capacity; i++)   {   array[i].key = 0;   array[i].data = 0;   } } void insert(int key, int data) {   int index = hashFunction(key);   if (array[index].data == 0)   {...

Link list implementation in c

// Linked list implementation in C #include <stdio.h> #include <stdlib.h> // Creating a node struct node {   int value;   struct node *next; }; // print the linked list value void printLinkedlist(struct node *p) {   while (p != NULL) {     printf("%d ", p->value);     p = p->next;   } } int main() {   // Initialize nodes   struct node *head;   struct node *one = NULL;   struct node *two = NULL;   struct node *three = NULL;   // Allocate memory   one = malloc(sizeof(struct node));   two = malloc(sizeof(struct node));   three = malloc(sizeof(struct node));   // Assign value values   one->value = 1;   two->value = 2;   three->value = 3;   // Connect nodes   one->next = two;   two->next = three;   three->next = NULL;   // printing node-value   head = one;   printLinkedlist(head); } 010100101010010101100101010010010 //...

Deque implementation in c

// Deque implementation in C #include <stdio.h> #define MAX 10 void addFront(int *, int, int *, int *); void addRear(int *, int, int *, int *); int delFront(int *, int *, int *); int delRear(int *, int *, int *); void display(int *); int count(int *); int main() {   int arr[MAX];   int front, rear, i, n;   front = rear = -1;   for (i = 0; i < MAX; i++)     arr[i] = 0;   addRear(arr, 5, &front, &rear);   addFront(arr, 12, &front, &rear);   addRear(arr, 11, &front, &rear);   addFront(arr, 5, &front, &rear);   addRear(arr, 6, &front, &rear);   addFront(arr, 8, &front, &rear);   printf("\nElements in a deque: ");   display(arr);   i = delFront(arr, &front, &rear);   printf("\nremoved item: %d", i);   printf("\nElements in a deque after deletion: ");   display(arr);   addRear(arr, 16, &front, &rear);   addRear(arr, 7, ...

Priority Queue in c implementation

// Priority Queue implementation in C #include <stdio.h> int size = 0; void swap(int *a, int *b) {   int temp = *b;   *b = *a;   *a = temp; } // Function to heapify the tree void heapify(int array[], int size, int i) {   if (size == 1) {     printf("Single element in the heap");   } else {     // Find the largest among root, left child and right child     int largest = i;     int l = 2 * i + 1;     int r = 2 * i + 2;     if (l < size && array[l] > array[largest])       largest = l;     if (r < size && array[r] > array[largest])       largest = r;     // Swap and continue heapifying if root is not largest     if (largest != i) {       swap(&array[i], &array[largest]);       heapify(array, size, largest);     }   } } // Function to insert an element into the tr...

circular queue implementation in c

// Circular Queue implementation in C #include <stdio.h> #define SIZE 5 int items[SIZE]; int front = -1, rear = -1; // Check if the queue is full int isFull() {   if ((front == rear + 1) || (front == 0 && rear == SIZE - 1)) return 1;   return 0; } // Check if the queue is empty int isEmpty() {   if (front == -1) return 1;   return 0; } // Adding an element void enQueue(int element) {   if (isFull())     printf("\n Queue is full!! \n");   else {     if (front == -1) front = 0;     rear = (rear + 1) % SIZE;     items[rear] = element;     printf("\n Inserted -> %d", element);   } } // Removing an element int deQueue() {   int element;   if (isEmpty()) {     printf("\n Queue is empty !! \n");     return (-1);   } else {     element = items[front];     if (front == rear) {       front = -1;       rear = -1; ...

Queue implementation in c

// Queue implementation in C #include <stdio.h> #define SIZE 5 void enQueue(int); void deQueue(); void display(); int items[SIZE], front = -1, rear = -1; int main() {   //deQueue is not possible on empty queue   deQueue();   //enQueue 5 elements   enQueue(1);   enQueue(2);   enQueue(3);   enQueue(4);   enQueue(5);   // 6th element can't be added to because the queue is full   enQueue(6);   display();   //deQueue removes element entered first i.e. 1   deQueue();   //Now we have just 4 elements   display();   return 0; } void enQueue(int value) {   if (rear == SIZE - 1)     printf("\nQueue is Full!!");   else {     if (front == -1)       front = 0;     rear++;     items[rear] = value;     printf("\nInserted -> %d", value);   } } void deQueue() {   if (front == -1)     printf("\nQueue is Empty!!");   els...

Stack implementation in c

// Stack implementation in C #include <stdio.h> #include <stdlib.h> #define MAX 10 int count = 0; // Creating a stack struct stack {   int items[MAX];   int top; }; typedef struct stack st; void createEmptyStack(st *s) {   s->top = -1; } // Check if the stack is full int isfull(st *s) {   if (s->top == MAX - 1)     return 1;   else     return 0; } // Check if the stack is empty int isempty(st *s) {   if (s->top == -1)     return 1;   else     return 0; } // Add elements into stack void push(st *s, int newitem) {   if (isfull(s)) {     printf("STACK FULL");   } else {     s->top++;     s->items[s->top] = newitem;   }   count++; } // Remove element from stack void pop(st *s) {   if (isempty(s)) {     printf("\n STACK EMPTY \n");   } else {     printf("Item popped= %d", s->items[s->top]);    ...

MY ALL ACCOUNTS CHECK OUT

MY YOUTUBE CHANNEL LAKSHMANKABLOG LINK 🔗 👇 https://youtube.com/channel/UCD1Uxll89kFIX365Iv9CB0Q MY SECOND YOUTUBE CHANNEL LAKSHMANSE 🔗 👇 https://youtube.com/channel/UCCP8oGEklRM8nAp0GGMoivg LAKSHMANKABLOG  (BLOG)  LINK 🔗👇 lakshmanka.blogspot.com Lakshmanofficial93 on Instagram : https://www.instagram.com/p/Cdaquc2Bwyu/?igshid=YmMyMTA2M2Y= Facebook ID  🔗 👇 https://m.facebook.com/dinesh.solankhi.52 WhatsApp Only for Coders  https://chat.whatsapp.com/L5fayeSJCr10d95aLV945b Working projects of web app 😄 https://lakshmabfirst.lakshmanmalviya.repl.co/