A queue is an abstract data structure that contains a collection of elements. Queue implements the FIFO mechanism i.e the element that is inserted first is also deleted first.A circular queue is a type of queue in which the last position is connected to the first position to make a circle.A program to implement circular queue in C++ is given as follows −Example#include using namespace std; int cqueue[5]; int front = -1, rear = -1, n=5; void insertCQ(int val) { if ((front == 0 && rear == n-1) || (front == rear+1)) { cout
The function getchar_unlocked() is deprecated in Windows because it is a thread unsafe version of getchar(). It is suggested not to use getchar_unlocked(). There is no stream lock check that’s why getchar_unlocked is unsafe. The function getchar_unlocked() is faster than getchar().Here is the syntax of getchar_unlocked() in C language, int getchar_unlocked(void);A program of getchar_unlocked() in C is as follows −Example Live Demo#include int main() { char val; val = getchar_unlocked(); printf("Enter the character : "); printf("Entered character : %c", val); return 0; }OutputHere is the outputEnter the character : a Entered character : aRead More
Random numbers can be generated in C++ using the rand() function. The srand() function seeds the random number generator that is used by rand().A program that uses rand() and srand() is given as follows −Example Live Demo#include #include #include using namespace std; int main() { srand(1); for(int i=0; i
To implement animation on the font-size property with CSS, you can try to run the following codeExampleLive Demo p { border: 2px solid black; width: 400px; height: 100px; animation: myanim 5s infinite; } @keyframes myanim { 70% { font-size: 30px; } } This is demo text
Use the grid-template-rows property to set the number of rows in a grid layoutExampleLive Demo .container { display: grid; background-color: green; grid-template-rows: auto auto; padding: 20px; grid-gap: 20px; } .container > div { background-color: orange; border: 2px solid gray; padding: 35px; font-size: 30px; text-align: center; } .ele1 { grid-row-start: 1; grid-row-end: 6; } Game Board 1 2 3 4 5 6
A queue is an abstract data structure that contains a collection of elements. Queue implements the FIFO mechanism i.e the element that is inserted first is also deleted first. In other words, the least recently added element is removed first in a queue.A program that implements the queue using linked list is given as follows −Example#include using namespace std; struct node { int data; struct node *next; }; struct node* front = NULL; struct node* rear = NULL; struct node* temp; void Insert() { int val; coutdata = val; front = rear; ... Read More
The attr() CSS function returns the value of an attribute of the selected element using CSSYou can try to run the following code to implement the attr() function in CSSExampleLive Demo a:before {content: " (" attr(href) ")";} Information Resource Resource: Welcome to Qries
To display columns and rows using named CSS, use the grid-area property, with the grid-template-areas propertyExampleLive Demo .container { display: grid; background-color: green; grid-template-areas: 'demo demo . . .' 'demo demo . . .'; padding: 20px; grid-gap: 10px; } .container > div { background-color: orange; text-align: center; padding: 10px 0; font-size: 20px; } .ele1 { grid-area: demo; } Game Board 1 2 3 4 5 6
Use the grid-row-gap property to set the size of the gap between rows in CSSExampleLive Demo .container { display: grid; grid-auto-rows: 50px; grid-column-gap: 30px; grid-row-gap: 50px; background-color: #95A5A6; padding: 10px; } .container>div { background-color: #F0F3F4; text-align: center; padding:10px 0; font-size: 20px; } .ele3 { grid-column-end: span 2; } 1 2 3 4 5 6
With CSS cursor property, you can show a crosshair or plus sign, pointer, etc. You can try to run the following code to implement cursor property in CSS −Example Auto Crosshair Default Pointer Move e-resize ne-resize nw-resize n-resize se-resize sw-resize s-resize w-resize text wait help ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP