Basic Graphic Programming in C++

sudhir sharma
Updated on 22-Nov-2019 07:06:43

21K+ Views

C++ programming language is a versatile programming language. Using C++ you can create low end graphics too i.e. creating basic shapes and words with stylish fonts and adding colors to them can be done using c++.Graphic programming can be done in c++ using your terminal or command prompt or you can download DevC++ compiler to create graphic programs.For terminal you need to add the graphics.h libraray to you GCC compiler. For this you will have type in the following commands.>sudo apt-get install build-essential >sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-2.0 \ guile-2.0-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev \ libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev \ ... Read More

Find the Radius of the Incircle of a Triangle in C++

Ayush Gupta
Updated on 21-Nov-2019 12:57:23

275 Views

In this tutorial, we will be discussing a program to find the radius of the incircle of a given triangle.For this, we will be provided with the sides of a particular triangle and our task is to find the radius of the incircle in that triangle.The formula for finding the radius of incircle isarea of the triangle/half perimeter of the triangleExample#include using namespace std; //calculating the radius of incircle float calc_radius(float a, float b, float c) {    if (a < 0 || b < 0 || c < 0)       return -1;    //half perimeter of ... Read More

C++ Program to Find Quantity After Mixture Replacement

Ayush Gupta
Updated on 21-Nov-2019 12:54:02

107 Views

In this tutorial, we will be discussing a program to find the quantity of milk left after mixture replacement.Let us suppose we have X litres of milk. From that, Y litres of milk is replaced with Y litres of water itself. This same procedure is done again and again Z number of times. Our task is to find the final amount of milk left in the container.Finding the relation among the values between the repetitive operations, we find the formula for finding the amount of milk after Z number of operations to beamount left = ((X-Y)/X)Z*XExample#include using namespace std; ... Read More

C Program for Hexagonal Pattern

Sunidhi Bansal
Updated on 21-Nov-2019 12:28:19

2K+ Views

We are given with an integer ‘n’ and the task is to generate the hexagonal pattern and display the final output.ExampleInput-: n=5 Output-:Input-: n = 4 Output-:Approach we are using in the given program is as follows −Input the number ‘n’ from userDivide the entire pattern into three parts i.e. upper part, middle part and lower part Start loop i for printing the upper part of the pattern from i to 0 and i to be less than n and keep incrementing the value of i Start loop m for printing the middle part of the pattern from m to ... Read More

Learn Microsoft Office Suite at a Professional Level

Swetha Prasanna
Updated on 21-Nov-2019 09:40:10

406 Views

Microsoft Office is a tool that most computer users across the globe use as a part of their daily lives with professionally or personally. The tool is so intertwined in the activities that we use at all levels of requirements – just from simply typing in a word document to using excel sheets at a complex level.When it comes to a professional level of learning, students and professionals look at acquiring deeper knowledge in software and technologies but tend to not realize the importance of MS Suite that is indispensable at every aspect of work. With decade-plus years of experience ... Read More

POSIX Character Classes in Java Regex

Maruthi Krishna
Updated on 21-Nov-2019 08:16:31

299 Views

This class matches the upper case alphabetic characters.Example 1import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Posix_LowerExample {    public static void main( String args[] ) {       //Regular expression to match upper case letters       String regex = "^\p{Upper}+$";       //Getting the input data       Scanner sc = new Scanner(System.in);       System.out.println("Enter 5 input strings: ");       String input[] = new String[5];       for (int i=0; i

POSIX Character Classes in Java Regex

Maruthi Krishna
Updated on 21-Nov-2019 08:14:19

317 Views

This class matches the lower case alphabetic characters i.e. a to z.Example 1import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Posix_LowerExample {    public static void main( String args[] ) {       //Regular expression to match lower case letters       String regex = "^\p{Lower}+$";       //Getting the input data       Scanner sc = new Scanner(System.in);       System.out.println("Enter 5 input strings: ");       String input[] = new String[5];       for (int i=0; i

Remove Non-ASCII Characters from Strings

Maruthi Krishna
Updated on 21-Nov-2019 08:10:22

1K+ Views

The Posix character class \p{ASCII} matches the ASCII characters and the meta character ^ acts as negation.i.e. The following expression matches all the non-ASCII characters."[^\p{ASCII}]"The replaceAll() method of the String class accepts a regular expression and a replacement-string and, replaces the characters of the current string (matching the given pattern) with the specified replacement-string.Therefore, You can remove the matched characters by replacing them with the empty string “, using the replaceAll() method.Example 1import java.util.Scanner; public class Exp {    public static void main( String args[] ) {       Scanner sc = new Scanner(System.in);       String regex = ... Read More

Match Regex Meta Characters in Java as Literal Characters

Maruthi Krishna
Updated on 21-Nov-2019 08:08:32

304 Views

The compile method of the patter class accepts two parameters −A string value representing the regular expression.An integer value a field of the Pattern class.The filed LITERAL of the enables literal parsing of the pattern. i.e. all the regular expression metacharacters and escape sequences don’t have any special meaning they are treated as literal characters. Therefore, If you need to match the regular expression metacharacters as normal characters you need to pass this as a flag value to the compile() method along with the regular expression.Exampleimport java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example {    public static void main(String[] ... Read More

Match a String Irrespective of Case Using Java Regex

Maruthi Krishna
Updated on 21-Nov-2019 08:06:13

279 Views

The compile method of the patter class accepts two parameters −A string value representing the regular expression.An integer value a field of the Pattern class.This CASE_INSENSITIVE field of the Pattern class matches characters irrespective of case. Therefore, if you pass as flag value to the compile() method along with your regular expression, characters of both cases will be matched.Example 1import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example {    public static void main( String args[] ) {       Scanner sc = new Scanner(System.in);       System.out.println("Enter input data: ");       String input = sc.nextLine(); ... Read More

Advertisements