Programming Shortcut

Write, Run and execute Your programs with simple and esay way by Programming Shortcut

Showing posts with label Programs in cpp. Show all posts
Showing posts with label Programs in cpp. Show all posts

Monday, July 29, 2019

Difference and similarities between java and c++

There are many differences and similarities between java and c++ and the following below discuss briefly in by the table one to one comparison into differences and similarities between java and c++

Features in JAVA in C++/CPP
Data abstraction and encapsulation
Polymorphism
Binding Static
Dynamic
Inheritance Single Inheritance
Multiple Inheritance
Operator overloading
Template classes
Global variables
Header files
Pointers
Interface and packages
API (Application Programming Interface)

Java and C++ or CPP are both object oriented programming language but may have different feature and work and use of the application. 
inheritance here is a bit difference between C++ and java. C++ supports are both single as well as multiple, multiple is a very complex inheritance mechanism. On the other hand, does not support multiple inheritances, supports only single inheritance. And, then operator overloading this is another important things; that means, that different operator, for example, the CPP can be used for adding two numbers, plus can be used for adding two documents like this is a polymer print concept actually.

Operator overloading is a concept of polymorphism. C++ allows operator overloading whereas, Java does not allow operator overloading. And, then template classes these basically C++ allow template class; that means, one template means is basic class can be developed which basically not suitable for creating an object, but it is a template only. But Java does not give any facilities to create a template class. There are few more things like a pointer is possible pointer is not possible in Java whereas, the pointer is possible in C++. And, interface and packages Java is a very good one features regarding this whereas, in C++, does not have.


More Code »

Function Oriented Programming and Object-Oriented Programming


What is the difference between in the Function Oriented Programming and then Object-Oriented Programming :

In the Function Oriented Programming and then Object-Oriented Programming and obviously, there are many good points and bad points of both programmings,
I have listed a brief summary of the different facilities that the Functionality Programming and then Object Oriented Programming provide us.


Function Oriented Programming:-


Programming Organization: Program is divided into small parts called functions.
Importance: Importance is not given to data but to functions.
Approach: Function Oriented Programming follows a top-down approach.
Access Specifiers: Function Oriented Programming dose not any access specifier.
Data Moving: Data can move freely from function to function in the system.
Maintainability: To add new data and function is not easy.
Data Access: function uses global data for sharing that can be accessed freely from function to function freely in the system.
Data Hiding: No data hiding is possible, hence security is not possible.
Overloading: Polymorphism is not possible.
Examples: C, Visual Basic, FORTRAN, Pascal.
 

Object-Oriented Programming:- 

Programming Organization: Program is divided into parts called objects.
Importance: Importance is given to the data rather than procedures.
Approach: Object-oriented programming follows a bottom-up approach.
Access Specifiers: Has three access specifiers, namely:- Public, Private, Protected.
Data Moving: Object can move and communicate with each other.
Maintainability: Provides an easy way to add new data and function.
Data Access: Object uses local data and can be accessed in a controlled manner.
Data Hiding: Provides data hiding, hence secured programming is possible.
Overloading: Ploymarphism is possible.
Exmaples: C++, JAVA, VB.NET, C#.NET.

More Code »

Wednesday, April 17, 2019

How to start learning first programming language

Introduction

When we start to learn your first programming language, we have many questions like how to start your first programming language and what we need to start your programming language and what language is better to start. Programming is a very useful and rewarding hobby. There are few better feelings than when someone sees you using a program you lashed together to make your life easier and says that it looks really useful. Most people have, at some point in their lives, really wanted to be able to do something on their computer or phone and been unable to. If you know a programming language, then there is often a fair chance that you can write a program to accomplish that task yourself. While there are a huge number of programming languages, many of them have a lot of similarities; this means that once you learn one language quite well, in most cases you will be able to pick up a new one far quicker.

Selecting Your First Language

Now that we have examined the limitations and handled some of the more unrealistic expectations, those of you still wanting to learn to code will be happy to know that programming is not a hard thing to start learning and will not require you to pay out huge sums of money. If you are reading this article online, you already have the resources to start with some languages, so let us consider what your first language ought to be.

Traditionally the first language a programming newcomer learns is either Visual Basic or Python. The first thing to understand is that these two languages are very different. The simplest difference is one of price. Python is totally free; you can start writing python now with just a text editor on your computer, though if you are on Windows, you will probably need to install it first. However, Visual Basic, often abbreviated to VB, is both free and not free. On the upside, VB can be simpler for newcomers to learn because it allows you to build the interfaces (the part of the program the user will see) by dragging and dropping the different parts much like designing it in some basic art application. The version of VB newcomers learn is usually Visual Basic 6, but this is rather outdated and has been discontinued. So these days the version learned is often VB.NET which can be considerably less simple for newcomers.

VB.NET must be developed inside what we call an IDE (Integrated Development Environment); this is basically a special program you use to write other programs. They also exist for Python, but their use is totally optional. The free VB.NET IDE is called Visual Studio Express. At the time of writing, the latest version is Visual Studio Express 2010. Unfortunately, by using the free version of the IDE you are restricted with what you can do, and any programs you create cannot be commercially sold on. Regretfully, the full paid version of the IDE is not cheap, and probably not appropriate for a hobbyist, but fortunately, to learn VB the free version is enough. In practice, very few commercial programs are developed in VB these days, but the Visual Studio IDE allows you to use many other languages. The familiarity you will develop by using it will also allow you to use the power of the IDE for development in many other languages. Some will argue that almost every language can be developed in a text editor and that they are by far the most flexible way in which to code. While this is technically true (and I do suggest trying development in a text editor to compare once you get a little better), I would strongly advise learning your first language with a proper IDE.

While traditionally, people learn Python or VB first and these are generally what is taught at schools, I would not suggest either of these. I am of the opinion that your first language should continue to be useful to you one it has served the purpose of helping you learn the fundamentals of programming. If I had to recommend one of these for newcomers, it would be VB.NET as often the most complex part of programming is the graphical side of things and in VB.NET this is very simple due to the drag and drop interface. These two languages are often used as introductions as they are very tolerant of mistakes, and allow you to become confident in programming principles without worrying about a lot of the more complex matters.

For those brave souls among you, I would actually suggest Java as your first language, even though it can be complex, and is therefore not a common choice for a first language. Java programs are different from most others in that they do not run on your computer. The user downloads Java, then your code runs on what is called a VM (Virtual Machine). This means that your code runs in a special place Java sets up for it - a fake copy of your computer - and handles the translation of this to the real machine for you. This means that Java programs are "cross-platform", meaning that they will, for the most part, run on Windows, Mac, Linux, and most other operating systems.

Java is a good language to learn, as it is very widespread and useful. Furthermore, it is very powerful and is available for free for both hobbyists and commercial uses. However, in contrast to VB and Python, it does not tolerate mistakes and requires you to be very specific about everything. It is also an object-oriented programming language, which is a very complex issue which I will briefly try to summarise. Languages like Python and VB are what is known as procedural languages, meaning that the lines of code are run one after another, whereas Java is an object-oriented language. object-oriented development is a term thrown around a lot these days in the programming world, and while not always appropriate it is generally considered a good idea. At the most basic level, an object-oriented program is all about objects. An object is an "instantiation" of a "class". A class is a blueprint used to describe something like a cat. The class contains both the data about the cat such as its name, age and owner as well as "methods" which are essentially actions the cat can perform, such as miaow. An instance of the class "cat" would give you a particular cat. However, this is not a Java tutorial, so if you are brave enough to experiment with Java you will come across this yourself in more detail. It is worth noting that VB.NET and Python both have support for object-oriented development, and Java has the potential to be used procedurally, but these are not the languages' primary intended uses and are not often used. If you did not understand that comparison, don't worry about it too much. Object orientation is hard to get your head around, but any basic Java or another object-oriented language tutorial will have you understanding everything in that paragraph.

A final reason Java is a good first language is that it is similar in many ways to Javascript, which is an entirely different class of language. Javascript is a scripting language (as is Python), and learning Java will mean you understand Javascript reasonably well. The difference is between scripting languages and normal programming languages are outside the scope of this article, but as large generalization scripts are generally used for automated tasks while programs are used interactively by users. This is not totally true, as both types of language are used for both tasks and most web programs are built in Javascript.

As for the actual language you pick, it is entirely up to you. Some may choose the traditional beginner languages or be brave and experiment with Java. Some of you may already have your eye on a language or fancy one of the more specialist languages like Scheme or Prolog. Whatever your choice, the way you will learn how to program is the same.


What IDEs ( Integrated Development Environment ) is best?

Many of the purists say that IDEs are a bad idea, and are packed with unnecessary tools and menus that take up disk space and time to learn. While this is true, I feel that an IDE is definitely worthwhile. Many people offer free IDEs, such as Eclipse and Netbeans, for the more popular languages. There is also Visual Studio, which I mentioned previously; it is very intuitive, very powerful and it supports many languages (much as Netbeans and Eclipse do). If you chose to use Java I would suggest Netbeans, as there is a packaged version of Netbeans with the JDK (Java Development Kit). Most languages need an SDK (Software Development Kit) to work with them, and getting it installed properly and linked to the IDE is often the hardest part of the procedure. Visual Studio already comes with the development kits set up, which makes life easier, but other languages like Java and Python can be quite hard to set up properly. This is why I suggested the Netbeans + JDK bundle for those experimenting with Java, as it handles the complex set up for you, which will save you hours of suffering.

There are, in my opinion, three major advantages to using a fully featured IDE. Firstly, they are usually extensible, meaning that there are many free plug-ins that could make your life a lot easier when you get a little more advanced. Secondly, and most importantly, is the ease with which an IDE allows you to debug your code. Most IDEs let you set breakpoints in the code, which will make the program stop when it gets to that point and let you step through it line by line so you can examine the contents of all the variables at any time. (For those of you who do not know what a variable is, I will briefly explain. A variable is a bit like a train station locker. You ask for one big enough to hold what you want to store, and if what you want to store is the right shape, it can be stored there. When you write a program, any data you want to store temporarily will be held in one of these until you are done with it.) As the old programming saying goes, if you have not found any bugs, you are not looking hard enough. Almost no non-trivial program will work the first time, and trying to work out where the problem lies without the use of a debugger is a pain I would not wish on anyone. Finally, an IDE will often give you advice on how to fix issues in the code. This can be very useful for fixing bugs and saves you having to resort to Google every other minute.

Learning Another Language

Once you have learned one language, whatever it may be, the most valuable thing you will have learned is all the keywords for searches. When you want to do something in a new language, you need only search for what you want to do and the language name. However, by now you will know the names used to refer to what you want to do, allowing your searches to be more effective and yield examples and answers much more quickly. As the fundamentals of programming are mostly the same, regardless of the language you use, you will hopefully be able to guess at the meaning of most of the code much more effectively once you locate an example, allowing you to pick up most of the language very quickly indeed.

Limits

One thing that all new programmers must come to term with is the amount of time learning a programming language takes. Although when you have become an expert you will be able to write many programs quickly, you must remember that many programs have taken whole teams of expert developers years to create. So it is important to understand that knowing a programming language or even several is not enough to write some of the more complex programs you have seen. Don't look upon this new hobby as a way to save yourself a lot of money, as writing your own version of most of the programs that you need to pay for now will be out of your reach.

The most important thing that a new programmer needs to know is that the "Learn Programming in 24 hours" sort of books is simply not true. A more accurate title would be "Learn Programming in 10,000 hours". If you put 24 hours or a week into learning a language you will not be creating the next Windows or a new, state of the art game. It is possible to learn to write a program in 10 minutes, and really all you need to learn a new language is your favorite search engine, but you will not be an expert. The only way to become an expert is much like learning the violin; the answer is practice, practice, and practices some more.

Practice makes a man perfect
More Code »

Monday, February 4, 2019

program to check a alphabet is vowel or consonant in c++

Hello Friends! Welcome to programming shortcut
Today will discuss:
--> Program to find whether the alphabet is a vowel or consonant  in c++ or
--> c++ program to check vowel or consonant using a switch or
--> program to check an alphabet is a vowel or consonant in c++


#include
using namespace std;
int main(){
 char ch;
 cout  cin>>ch;
 switch(ch)
 {
  case 'a':
  case 'e':
  case 'i':
  case 'o':
  case 'u':
  case 'A':
  case 'E':
  case 'I':
  case 'O':
  case 'U':
   cout    break;
  default:
   cout  }
 return 0;
}



Output:

   First, run:
   Enter the alphabet :
   a
   The alphabet is a vowel

   Second-time run:
   Enter the alphabet :
   d
   The alphabet is a consonant

Explanation: In this programming, we use the Switch case to check an alphabet is a vowel or consonant


Hello, Friend We first write the program and compile them and run the program to check compiler error or run time error.
Please share the site and comment on your ideas and your suggestions. All suggestion was all welcome.
If any question or doubt in the programming please mention the comment.
Thank yours very much. 
More Code »

Sum of digits of a number until the sum is reduced to 1 digit in c++

 Hello Friends! Welcome to Programming Shortcut
Today will discuss do while loop with an example, how to make a program in c++ by the do-while loop, do while loop in c++ with an example with explanation.
 Write a program in c++ to find the sum of digits of a number until the sum is reduced to 1 digit.
 For example
  The number is 538769.
  Then 5+3+8+7+6+9=38
            3+8=11
            11=2

Sum of digits of a number until the sum is reduced to 1 digit in c++ program

#include
using namespace std;
int main()
{
long num,dig,sum;
cout cin>>num;
cout do{
sum = 0;
while(num!=0)
{
dig=num%10;
sum+=dig;
num/=10;
}
cout" num=sum;
}while(num/10!=0);  /*while num is more than one digit*/
return 0;
}

Output: Enter The number 538769
            538769->38->11->2

Explanation :

      do{
/* 1: program code */
}while(num/10!=0);

                The Above Condition is not exit while num. is more than one digit.
     
/* 1: program code */
while(num!=0) 
{
dig=num%10;
sum+=dig;
num/=10;
}

     Here we use program code to find a sum of digit then the given program example is for "Sum of digits of a number until the sum is reduced to 1 digit"

So we find Your Program what we want. 

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c programming code or input & output please comment below
If you have another question about c programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!
More Code »

How to reverse a number in c++ program

Hello friends! welcome to my blog
Today will discuss the basic concept and simplest way to how to reverse a number in c++ by programming and how to make program for reverse of a number without array in c++ programming. How to how to count number of digit in a number in c++ programming.

write a program to reverse a number



#include
using namespace std;
int main()
{
    int n, r=0,d;
    cout cin>>n;
cout while(n>0){
d= n%10;
r= r*10+d;
n=n/10;
}
cout return 0;
}


Output: Enter the Number
             1234
     Number befour reverse= 1234
     Number After reverse= 4321

program to count no of digit of a number

#include
using namespace std;
int main()
{
int n, c=0,d;
    clrscr();
    cout cin>>n;
while(n>0){
d= n%10;
n=n/10;
c++;
}
cout return 0;
}


Output:Enter the Number
            1234
    The enter number have 4 digit
 


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form are given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!
More Code »

sum of digits and product of digits program in cpp

Hello Friends! Welcome to my blog
Today We will Discus about how to calculate sum of digit and product of digit using while loop of a number of c++ programming language
The sum of digit of a number is added every digit of number
For example
a number is 5392 then sum of digit is 5+3+9+2=19
And product of digit of a number is multiplication of each digit
For Example
a number is 5392 then product of digit is 5*3*9*2=270
See programming Example:

c++ program find to sum of digits



      #include
      using namespace std;
 int main(){
            int n ,d,sum=0;
            cout             cin>>n;
            while(n>0){
                d=n%10;
                sum=sum+d;
                n=n/10;
           }
      cout return 0;
     }


Output:
enter The number
185755
The sum of digit= 31


C++ program to find product of digits


    #include
    using namespace std;
    int main(){
       int n ,d,pro=1;
       cout        cin>>n;
       while(n>0){
          d=n%10;
          pro=pro*d;
          n=n/10;
        }
        cout return 0;
    }

Output:
enter The number
5846
The product of digit= 960


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

More Code »

Switch case in program cpp example

Hello friends! Welcome to my blog

Today we discuss How to use switch case conditional statement in c++ and how to program switch case in c++ programming examples

What is switch Case?

Switch case is a multi-way conditional statement. It Works like as if else if nested conditional statement.But the Advantage of using Switch case over if else if nested conditional statement Management of switch case is easy
See Switch case example below that how work switch statement:


Switch case in program c++ example


#include
using namespace std;
int main()
{
char op;
long  a,b,r;

cout cin>> a;
 cin>>b;
cout cin>>op>>endl;
switch(op)
{
case '+':
         r=a+b;
         cout break;
case '-':
r=a-b;
        cout break;
case '*':
r=a*b;
        cout break;
case '/':
        r=a/b;
        cout break;
default:
cout }
return 0;
}


Output: Enter two number to calculate:
             10
              4
Please chooese a operator +, -, *, /
              +
10 + 4 =14


   
I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!

      
More Code »

how to swap two numbers without temp program in c++

Hello friends! Welcome to my website

Today we show you how to swap two numbers without temp or how to swap two numbers without using third variable in c++ and c++ program to swap two numbers. how to swap two number in cpp with using third variable and swap with third variable


How to swap two numbers without using third variable in c++


#include
using namespace std;
int main() {

int a,b;

cout cin>>a;
cin>>b;
cout a=a+b;
b=a-b;
a=a-b;
cout return 0;
}


  Output: Enter two numbers:
     4
   5
  Before swap:
   a=4
   b=5
  After swap:
   a=5
   b=4


C program to swap two numbers


#include
using namespace std;
int main() {

int a,b,temp;

cout cin>>a;
cin>>b;
cout temp=a;
a=b;
b=temp;
cout return 0;
}


  Output: Enter two numbers:
     4
   5
  Before swap:
   a=4
   b=5
  After swap:
   a=5
   b=4



I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

C++ program for Fibonacci series

Hello friends! Welcome to my website

Program to generate Fibonacci series programming in c++. How to use for loop in c++ language for example
In this Fibonacci series, each number is a sum of the previous two numbers. fibonacci series programming c++ , Fibonacci series c++ programming, Fibonacci series c++ code in c++ session

How to print Fibonacci series programming in c++


    #include
    using namespace std;

    int main() {
        long x, y, z;
        int i, n;
        x = 0;
        y = 1;
        cout         cin>>n;
        cout         for (i = 1; i             z = x + y;
            cout             x = y;
            y = z;
        }
        cout return 0;
    }


Output: Enter the number of terms: 10
        1, 1, 2, 3, 5, 8, 13, 21, 34, 55,


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut
Please any query email programmingshortcut@gmail.com

Please comment your experience on this post,
Thank You!
More Code »

List of even and odd numbers list 1 to n in c++

Hello friends! Welcome to my website

Today We Run a program to print all even and odd numbers lists in oops concepts in c++.
This session is how to print the even or odd numbers list in c++ Programming. Here we show you, how to use while loop and if loop programming with Example and oops concepts in c++
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.


Print all even numbers between 1 to n in c++

#include
#include
using namespace std;
class test1 {
public:
int n;
void printeven(int n) {
int i =0;
while ( i if(i%2==0){
cout }
i++;
}
}
};
int main() {
test1 o ;
cout cin>>o.n;
cout o.printeven(o.n);
}


Output:    Enter a Number till want list: 20
All Even Number list
0, 2, 4, 6, 8, 10, 12, 14, 16, 18,


Print all odd numbers between 1 to n in c++

#include
#include
using namespace std;
class test1 {
public:
int n;
void printeven(int n) {
int i =0;
while ( i if(i%2==1){
cout }
i++;
}
}
};
int main() {

test1 o ;
cout cin>>o.n;
cout o.printeven(o.n);
}


Output:    Enter a Number till want list: 20
All Odd Number list
1, 3, 5, 7, 9, 11, 13, 15, 17, 19,

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

Find even or odd in c++ programming

Hello friends! Welcome to my website

Today We Run a program to check a number is an even number or an odd number in c++.by object-oriented programming in c++
This session is how to check the number is even or odd in c++ Programming. Here we show you, how use of For loop in c++ programming with Example and oops concepts in c++
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

How to Find a number is an even or odd in c++ Programming?


#include
#include
using namespace std;

class test5 {
public:
    int n;
void odd_even(int n) {
if ((n % 2) == 0) {
cout } else {
cout }
}
}
int main() {
test5 o ;
cout cin>>o.n;
o.odd_even(o.n);
    return 0;
}


Output: Enter a Number to check Even or odd: 2
             2 is an Even Number
            Enter a Number to check Even or odd: 3
            3 is an Odd Number

Note: This program is run 2-time output.

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!

More Code »

While loop in c++

Hello friends! Welcome to my website

Today We Run a program to print 1 to 10 number in c++ language.
This session is how to print number 1 to 10 and 1 to 10 with the difference of 2 in c++ Programming. Here use of while loop in c++ programming with Example
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

Program to print numbers 1 from 10 in c++ 


#include
#include
using namespace std;
class testnumber {
public:
void printwithone() {
        int i = 1;
        while (i             cout             cout             i++;
        }
    }
};
int mian(){
    testnumber o;
    o.printwithone();
return 0;
    }
}


Output: 1 2 3 4  5 6 7 8 9 10


Program to print numbers 1 from 10 with difference of 2 in c++


#include
#include
using namespace std;
class testnumber {
public:
void printwithone() {
        int i = 1;
        while (i             cout             cout             i=i+2;
        }
    }
};
int mian(){
    testnumber o;
    o.printwithone();
return 0;
    }
}


Output: 1 3 5 7 9


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcut

Please share your experience about this post,
Thank You!
More Code »

Find the prime number in c++ Programming

Hello friends! Welcome to my website

Today We Run a program to check prime number in c++.
This session is how to check the number is prime or not in c++ Programming. Here use of while loop in c++ programming with Example
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

How to Find the prime number in c++ Programming?



#include
#include
using namespace std;
class Newprime {
public:
    int n;
      void isprime(int n) {
        int i, m = 0, f = 0;
         m = n / 2;
        if (n == 0 || n == 1) {
            cout         } else {
            for (i = 2; i                 if (n % i == 0) {
                    cout                     f = 1;
                    break;
                }
            }
            if (f == 0) {
                cout             }
        }
    }
}
int main() {
        Newprime o ;
        o.isprime(3);
        o.isprime(4);
        o.isprime(5);
return 0;
    }
}


Output: 3 is prime number
4 is not prime number
5 is prime number


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.
I am Try to Help in your Programming Language by Programming Shortcuts

Please share your experience about this post,
Thank You!

More Code »

Area of a rectangular ground in c++ programming by class and object

Hello friends! Welcome to my website

Today We Run a program to find Area of a Rectangular Ground in c++ by class and object.
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

How to find the area of a rectangular ground in c++ programming?


#include
#include
using namespace std;
class Rect_Ground{
public:
    double l, w;
    void area(double l, double w) {
        double result;
        result = l * w;
        cout     }
};
int main() {
    Rect_Ground R;
    cout     cin >> R.l;
    cout     cin >> R.w;
    B1.volume(R.l, R.w);
    return 0;
}


Output: enter the value of length: 15
             enter the value of width: 10
     The area of the Rectangular Ground:150 square unit;


Note: To find Curricular Ground Area, take the radius of the curricular ground as input and use a function as a single parameter and calculate:
          'result= (22/7)*r*r
          where r is the radius and 22/7 use as Pie Value

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.

Please share your experience about this post,
Thank You!
More Code »

Find grade of a student according to their percentage in c++ programming

Hello friends! Welcome to my website

Today we run C++ programming to find out the grade of a student when the marks of 6 subjects are given.
The method of assigning grade is -
percentage>=85       grade=A
percentage=70 grade=B
percentage=55 grade=C
percentage=40 grade=D
percentage

This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.

Find grade of a student according to their percentage in c++ programming


#include
#include
using namespace std;

class test2 {
public:
    double m1, m2, m3, m4, m5, m6;
    string grade, name;
     void Getgrade(double m1,double m2,double m3,double m4,double m5,double m6,string grade,string name) {
        double pre, total;
//total Maarks of all subject
        total = m1 + m2 + m3 + m4 + m5 + m6;
        pre = total / 6;
        if (pre > 33) {
            if (pre >= 85) {
                grade = "A";
                cout             }
            else if (pre >= 70) {
                grade = "B";
                cout             }
            else if (pre >= 55) {
                grade = "C";
                cout             }
            else if (pre >= 40) {
                grade = "D";
                cout             }
            else {
                grade = "E";
                cout             }
        }
        else {
             cout         }
    }
}

int main(){
test2 o ;
     cout      o.name = c.nextLine();
     cout      cin>>o.m1;
     cin>>o.m2;
     cin>>o.m3;
     cin>>o.m4;
     cin>>o.m5;
     cin>>o.m6;
     o.Getgrade(o.m1,o.m2,o.m3,o.m4,o.m5,o.m6,o.grade,o.name);
}


Output:
     Please Enter the Student Name:Abcd
enter all the marks of Abcd: 75
74
45
89
100
99
Abcd passed with B Grade and 80.33333333333333%


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.

Please share your experience about this post,
Thank You!
 
More Code »

Find a year is a leap year or not in c++


Hello friends! Welcome to my website
C++ programming to find the weather a year is a leap or not that year entered by the user?
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.


Program to find whether a year is a leap or not in c++

#include
#include
using namespace std;

class Test {
 public:
    int year;

    void show_laep_year(int year) {
        if (year % 100 != 0) {
            if (year % 4 == 0) {
                cout             }
            else {
                cout             }
        } else {
            if (year % 400 == 0) {
                cout             }
            else {
                cout             }
        }
    }
}
int main(){

        test1 o = new test1();
        cout         cin>>o.year;
        o.show_laep_year(o.year);
    }
}


Output:
     Please Enter a Year: 2016
     The year 2016 is a Leap Year

      Please Enter a Year: 2015
     The year 2015 is not a Leap Year



I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.

Please share your experience about this post,
Thank You!


More Code »

Biggest and smallest from three given numbers in c++

Hello friends! Welcome to my website
C++ programming to find the biggest and the smallest number between two numbers?
This c++ language programming is free all type of errors like the compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with the output. This programming output is customized to understand easily.


Find the biggest and the smallest number from three given numbers in c++


#include
#include
using namespace std;

class Test {
public:
    int a, b,c;

    void biggest(int a, int b, int c) {
       if(a>b && a>c){
   cout    }
   else if(b>a && b>c){
   cout    }
   else{
        cout    }
    }
void smallest(int a, int b, int c) {
       if(a    cout    }
   else if(b    cout    }
   else{
        cout    }
    }
};

int main() {

    Test o;
    cout     cin >> o.a;
    cout     cin >> o.b;
cout     cin >> o.b;
    cout o.biggest(o.a, o.b, o.c);
    cout     o.biggest(o.a, o.b, o.c);
    return 0;
}


  Output:
    Please Enter the frsit number: 12
Please Enter the second number: 15
Please Enter the third number: 11
-----------------
15 is  biggest than 12 and 11
-----------------
11 is  smallest than 12 and 15



I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any doubt about this c++ programming code or input & output please comment below
If you have another question about c++ programming send an email by contacting us form is given on the page right side.

Please share your experience about this post,
Thank You!
More Code »

Bigger and smaller number in c++

Hello friends! Welcome to my website
C++ programming to find the bigger and smaller number between two numbers?
This c++ language programming is free all type of errors like compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code with their output. This programming output is customized to understand easily.

Program to print the bigger and smaller number between two numbers in c++ language


#include
#include
using namespace std;

class Test {
public:
    int a, b;

    void bigger(int a, int b) {
        if (a > b) {
            cout         }
        else {
            cout         }
    }

    void smaller(int a, int b) {
        if (a             cout         }
        else {
            cout         }
    }
};

int main() {

    Test o;
    cout     cin >> o.a;
    cout     cin >> o.b;
    cout     o.bigger(o.a, o.b);
    o.smaller(o.a, o.b);
    return 0;
}


output:
Enter the frist number: 4
Enter the second Number: 8
Result is following:
8 is bigger than  4
4 is smaller then 8


I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any dought about this c++ programming code or input & output please comment below
If you have other question about c++ programming send an email by contacting us form are given on page right side.
Thank You!
More Code »

Arithmetic operation by class and object in c++

Hello friends! Welcome to my website
How to make a c++ programming for basic arithmetic operation by Class and Object?
What is class and object in c++
This c++ language programming is free all type of errors like compiler and runtime errors and this programming is tested to compile and then run the program code.
Here is only programming code only with their output.This programming output is highly optimised to output understood easily

How to make basic arithmetic operation by class and object in c++ programming

//----Start-Code----
#include
#include
using namespace std;

class Test {
public:
    double a, b;

    void add(double a, double b) {
        double result;
        result = a + b;
        cout     }

    void subtract(double a, double b) {
        double result;
        result = a - b;
        cout     }

    void multiply(double a, double b) {
        double result;
        result = a*b;
        cout     }

    void divide(double a, double b) {
        double result;
        result = a / b;
        cout     }
};

int main() {

    Test o;
    cout     cin >> o.a;
    cout     cin >> o.b;
    cout     o.add(o.a, o.b);
    o.subtract(o.a, o.b);
    o.multiply(o.a, o.b);
    o.divide(o.a, o.b);
 
    return 0;
}
//----End code----


Output:  Enter the first number: 5
              Enter the second Number: 4
Result:
5 + 4 = 9
             5 - 4 = 1
             5 * 4 = 20
             5 / 4 = 1.25


Note: double is a type of variable that supports to decimal values.I Use double for Store all result

I make this programming and hope you are like the post if are you like the post you can please comment and Share the post to reach more people.
If any dought about this c++ programming code or input & output please comment below
If you have other question about c++ programming send an email by contacting us form are given on page right side.
Thank You!  
More Code »
Older Posts Home

About Programming Shortcut

This is a programming learning website that can help you learn and when your write your programming code. And all programming code is compiled run programming code in the following programming language C, c++, Java, php and Javascript Languages. find your programming read, understand the programming then copy and past and run your program and save your golden time to typing the program becuse you learn more in leas time. All Programming is codeing is ease to understand the programming