Adopt a Flex Div's Width to Content in HTML

Lakshmi Srinivas
Updated on 29-Jan-2020 08:10:22

336 Views

Use display: inline-flex to adopt a flex div’s width to content:#box {    display: inline-flex;    flex-direction: row;    flex-wrap: wrap;    max-width: 200px;    padding: 10px;    margin: 20px;    background-color: blue; }

Update HTML5 Canvas Rectangle on Hover

Daniol Thomas
Updated on 29-Jan-2020 08:09:58

660 Views

To update HTML5 canvas rectangle on hover, try to run the following code:var canvas = document.getElementById("myCanvas"); var context = canvas.getContext("2d"); context.rect(20,20,150,100); context.stroke(); $(canvas).hover(function(e){    context.fillStyle = blue;    context.fill(); });

Create Multi-Column Layout in HTML5 Using Tables

Nishtha Thakur
Updated on 29-Jan-2020 08:09:25

950 Views

Design your webpage to put your web content on multiple pages. You can keep your content in the middle column, you can use left column to use menu, and right column can be used to put an advertisement or some other stuff.Example           Three Column HTML Layout                                                    Main Menu                HTML                PHP                PERL...                                        Technical and Managerial Tutorials                                        Right Menu                HTML                PHP                PERL...                                

Application of Bertrand's Ballot Theorem in C/C++

Arnab Chakraborty
Updated on 29-Jan-2020 07:51:43

242 Views

In Bertrand's original paper, he explains a proof depended on a general formula for the number of favourable sequences implementing a recursion relation.ExampleLet there are 5 voters, of whom 3 vote for candidate A and 2 vote for candidate B (so p = 3 and q = 2). Ten possibilities are exist for the order of the votes cast −AAABBAABABABAABBAAABAABBAABABABAABAABBAABABAABBAAAFor the order AABAB, the tally of the votes as the election progresses is given below −CandidateAABABA12233B00112For each column the tally for A is always greater than the tally for B so the A is always strictly ahead of B. For ... Read More

Convert One String to Another Using Append and Delete Operations in C++

Ayush Gupta
Updated on 29-Jan-2020 07:49:47

151 Views

In this tutorial, we will be discussing a program to convert one string to other using append and delete last operations.For this we will be provided with two strings. Our task is to calculate whether the first string can be converted into the second one by performing k operations of append and delete last element.Example#include using namespace std; //checking if conversion between strings is possible bool if_convert(string str1, string str2, int k){    if ((str1.length() + str2.length()) < k)    return true;    //finding common length of both string    int commonLength = 0;    for (int i = ... Read More

Convert Decimal Number to Roman Numerals in C++

Ayush Gupta
Updated on 29-Jan-2020 07:45:23

436 Views

In this tutorial, we will be discussing a program to convert decimal number lying between 1 to 3999 to roman numerals.For this we will be provided with a random integer. Our task is to convert the given number into its roman numeral equivalent.Example Live Demo#include using namespace std; //converting decimal to roman numeral int printRoman(int number){    int num[] = {1,4,5,9,10,40,50,90,100,400,500,900,1000};    string sym[] =    {"I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M"};    int i=12;    while(number>0){       int div = number/num[i];       number = number%num[i];       while(div--){          cout

Convert to Number with Digits as 3 and 8 Only in C++

Ayush Gupta
Updated on 29-Jan-2020 07:44:12

97 Views

In this tutorial, we will be discussing a program to convert a number to have digits as 3 and 8 only.For this we will be provided with a random number. Our task is to convert its digits to be only 3 and 8 by either adding/subtracting 1 from the number or converting digits of the number to any desired digit.Example Live Demo#include using namespace std; //calculating minimum operations required int cal_min(long long int num){    //calculating remainder and operations    int rem;    int count = 0;    while (num) {       rem = num % 10;   ... Read More

All Combinations of Strings to Dial a Number in C/C++

Arnab Chakraborty
Updated on 29-Jan-2020 07:43:50

162 Views

With respect of a given number, display or print all possible combinations of strings that can be implemented to dial the given number in a phone with the help of following pecifications.In the given phone, we can dial, 2 implementing A or B or C, 3 implementing D or E or F, ……………….8 implementing T or U or V, 9 implementing W or X or Y or Z, 1 implementing only 10 implementing 0.For example if 89, is the given phone number, the program should printTW, TX, TY, TZ, UW, UX, UY, UZ, VW, VX, VY, VZ#include #include ... Read More

Convert to Strictly Increasing Integer Array with Minimum Changes in C++

Ayush Gupta
Updated on 29-Jan-2020 07:43:14

214 Views

In this tutorial, we will be discussing a program to convert to strictly increasing integer array with minimum changes.For this we will be provided with an array. Our task is to change the elements of the array to be in strictly increasing order by minimum number of changes in the elements.Example Live Demo#include using namespace std; //calculating number of changes required int remove_min(int arr[], int n){    int LIS[n], len = 0;    for (int i = 0; i < n; i++)    LIS[i] = 1;    for (int i = 1; i < n; i++) {       ... Read More

Convert Roman Numerals to Decimal in C++

Ayush Gupta
Updated on 29-Jan-2020 07:40:25

394 Views

In this tutorial, we will be discussing a program to converting roman numerals to decimal lying between 1 to 3999.For this we will be provided with a random roman numeral. Our task is to convert the given roman numeral into its decimal equivalent.Example Live Demo#include using namespace std; //calculating the decimal value int value(char r){    if (r == 'I')    return 1;    if (r == 'V')    return 5;    if (r == 'X')    return 10;    if (r == 'L')    return 50;    if (r == 'C')    return 100;    if (r == 'D')   ... Read More

Advertisements