CSS flex-shrink property

Ankith Reddy
Updated on 24-Jun-2020 11:35:12
The flex-shrink property shrinks the flex-item.You can try to run the following code to implement the CSS flex-shrink property. Here, I have used it with Q4 flex-itemExampleLive Demo                    .mycontainer {             display: flex;             background-color: orange;          }          .mycontainer > div {             background-color: white;             text-align: center;             line-height: 40px;             font-size: 25px;             width: 100px;             margin: 5px;          }                     Quiz                Q1          Q2          Q3          Q4          Q5          Q6          Q7          Q8          Q9          

Access Modifiers in C++

George John
Updated on 24-Jun-2020 11:34:49
Access Modifiers are used to implement data hiding in object oriented programming. There are three types of access modifiers used in C++. These are public, private and protected. Details about these are given as follows.Public Access ModifierThe data members and member functions in a class that are declared public are available to everyone, including other classes. They can be accessed from any place in the program using the dot operator with the class object.A program that demonstrates public access specifier is given as follows.Example Live Demo#include using namespace std; class Add {    public:    int a, b;    void sum() ... Read More

C++ Program to Implement Sorted Array

Arjun Thakur
Updated on 24-Jun-2020 11:31:52
A sorted array is an array in which each of the elements are sorted in some order such as numerical, alphabetical etc. There are many algorithms to sort a numerical array such as bubble sort, insertion sort, selection sort, merge sort, quick sort, heap sort etc. More details about sorting the array using selection sort are given below.The selection sort is a sorting method that yields a sorted array. It does so by repeatedly finding the smallest element in the array and interchanging it with the element at the starting of the unsorted part.A program that implements a sorted array ... Read More

C++ Program to Implement Sparse Matrix

Ankith Reddy
Updated on 24-Jun-2020 11:30:57
A sparse matrix is a matrix in which majority of the elements are 0. An example for this is given as follows.The matrix given below contains 5 zeroes. Since the number of zeroes is more than half the elements of the matrix, it is a sparse matrix.5 0 0 3 0 1 0 0 9A program to implement a sparse matrix is as follows.Example Live Demo#include using namespace std; int main () {    int a[10][10] = { {0, 0, 9} , {5, 0, 8} , {7, 0, 0} };    int i, j, count = 0;    int row = 3, col = 3;    for (i = 0; i < row; ++i) {       for (j = 0; j < col; ++j){          if (a[i][j] == 0)          count++;       }    }    cout

C++ Program to Implement Singly Linked List

George John
Updated on 24-Jun-2020 11:29:29
Singly linked list is a type of data structure that is made up of nodes that are created using self referential structures. Each of these nodes contain two parts, namely the data and the reference to the next list node. Only the reference to the first list node is required to access the whole linked list. This is known as the head. The last node in the list points to nothing so it stores NULL in that part.A program to implement singly linked list is given as follows.Example Live Demo#include using namespace std; struct Node {    int data;   ... Read More

Change the size of the pagination with CSS

Krantik Chavan
Updated on 24-Jun-2020 11:28:45
To change the pagination size, use the font-size property. You can try to run the following code to increase the size of pagination:ExampleLive Demo                    .demo {             display: inline-block;          }          .demo a {             color: red;             padding: 5px 12px;             text-decoration: none;             transition: background-color 2s;             border: 1px solid orange;             font-size: 18px;          }          .demo a.active {             background-color: orange;             color: white;             border-radius: 5px;          }          .demo a:hover:not(.active) {             background-color: yellow;          }          .demo a:first-child {             border-top-left-radius: 10px;             border-bottom-left-radius: 10px;          }          .demo a:last-child {             border-top-right-radius: 10px;             border-bottom-right-radius: 10px;          }                     Our Quizzes                          

strspn() in C

Samual Sam
Updated on 24-Jun-2020 11:28:22
The function strspn() is used to calculate the length of substring of first string which is present in second string. It returns the length of that substring.Here is the syntax of strspn() in C language,size_t strspn(const char *string1, const char *string2);Here is an example of strspn() in C language,Example Live Demo#include #include int main() {    const char s1[] = "Helloworld!";    const char s2[] = "Hello";    int length = strspn(s1, s2);    printf("The length of string : %d", length);    return 0; }OutputThe length of string : 5

ispunct() in C

karthikeya Boyini
Updated on 24-Jun-2020 11:28:00
The function ispunct() is used to check that the passing character is a punctuation or not. It returns zero, if it is not a punctuation, otherwise it returns a non-zero value.Here is the syntax of ispunct() in C language, int ispunct(int character);Here is an example of ispunct() in C language, Example Live Demo#include #include int main() {    int a = '!';    int b = 'a';    if(ispunct(a))    printf("The character is a punctuation.");    else    printf("The character is not a punctuation.");    if(ispunct(b))    printf("The character is a punctuation.");    else    printf("The character is not a ... Read More

Use of fflush(stdin) in C

Samual Sam
Updated on 24-Jun-2020 11:27:30
The function fflush(stdin) is used to flush the output buffer of the stream. It returns zero, if successful otherwise, returns EOF and feof error indicator is set.Here is the syntax of fflush(stdin) in C language,int fflush(FILE *stream);Here is an example of fflush(stdin) in C language,Example Live Demo#include #include int main() {    char s[20] = "Helloworld";    printf("The string : %s", s);    fflush(stdin);    return 0; }OutputThe string : Helloworld

strdup() and strdndup() in C/C++

karthikeya Boyini
Updated on 24-Jun-2020 11:27:03
strdup()The function strdup() is used to duplicate a string. It returns a pointer to null-terminated byte string.Here is the syntax of strdup() in C language, char *strdup(const char *string);Here is an example of strdup() in C language, Example Live Demo#include #include int main() {    char *str = "Helloworld";    char *result;    result = strdup(str);    printf("The string : %s", result);    return 0; }OutputThe string : Helloworldstrndup()The function strndup works similar to the function strndup(). This function duplicates the string at most size bytes i.e. the given size in the function. It also returns a pointer to null-terminated ... Read More
Advertisements