Skip to main content

Featured

How to make a simple calculator with GUI in JAVA (using Netbeans)?

First of all create a new package , then create a simple class. Then create a new JFrame Form class. On the right side you will find every tool needed like buttons textfield radio buttons etc. We'll need the buttons and text field and a JLabel Drag and drop required buttons you want to appear on the calculator eg. 1,2,3,4,5,6,7,8,9,0,+,-,*,/,=,AC,OFF arrange them all then on double clicking any button you will enter the source code tab, for digits 0-9 you have to write this code:         String Number =answer.getText() +  one.getText();         answer.setText(Number); Here answer is the jTextFields variable name you can right click the text field and click change variable name. similarly you have to set the code for every digit then for operations you have to write the code: for "+" operation: firstnumber = Double.parseDouble(answer.getText());         jLabel1.setText(answer.getText()+"+"); ...

How to run visual studio to make a c++ program? (Beginners Tutorial)

How to run Microsoft Visual Studio and make a simple program?



Today i'll teach you how to run Visual Studio and make a small program for beginners.


First of all some intro to C++

C++ (pronounced cee plus plus /ˈs plʌs plʌs/) is a general-purpose programming language. It has imperativeobject-oriented and generic programming features, while also providing facilities for low-level memory manipulation.
It was designed with a bias toward system programming and embedded, resource-constrained and large systems, with performance, efficiency and flexibility of use as its design highlights.[5] C++ has also been found useful in many other contexts, with key strengths being software infrastructure and resource-constrained applications,[5] including desktop applications, servers (e.g. e-commerceweb search or SQL servers), and performance-critical applications (e.g. telephone switches or space probes).[6] C++ is a compiled language, with implementations of it available on many platforms and provided by various organizations, including the Free Software Foundation (FSF's GCC)LLVMMicrosoftIntel and IBM.

(Via Wikipedia)

Now coming to our tutorial.

Download Microsoft Visual Studio 
Install it
and open Microsoft Visual Studio

Now Select C++ development option from the first start page.When you arrive to the main page of Visual Studio

Click >File>New>Project


Then Select Empty Project
Write file name and select location


 Then After That right click on sources files in the left side as in the screenshot below.
Click >Add > New Item




After That select C++ File and enter file name then click Add




Then you will come to a window like this but empty,you need to enter your c++ commands in this white area as show in Screenshot below.

In this example below i have made a simple addition program
User enters two numbers then it will add up those numbers much like a calculator.




Here is the code if you want to copy.








 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
using namespace std;
int main()
{
	//Variable Declaration Comment
	int m;
	int n;
	int O;
	
	//1st Display
	cout<<"  \n\n\n  Enter first number:  ";
	cin>>m;
		
	cout<<"   \n\n\n  Enter second number:  ";
	cin>>n;

	O=m+n;
	cout<<"  \n\n  The sum of numbers is  "<<O<<" ";

	while(n>0)
		{
			{
	cout<<"  \n\n\n  Enter first number:  ";
	cin>>m;
		
	cout<<"   \n\n  Enter second number:  ";
	cin>>n;

	O=m+n;
	cout<<"  \n\n  The sum of numbers is  "<<O<<" ";
		}
	}
	return 0;
}

Comments