This is a simple program written in java that will be useful to create a simple login frame of any website or any java application. The main theme of this logic is to use the AWT framework design. No doubt, the login frame designing way is a bit older, but still one can easily understand and implement though. So have a look at the code.Sample Output: Required Code: import java.awt.*;import java.awt.event.*;class LoginFrame extends Frame implements ActionListener{ Label l1,l2; TextField tf1,tf2; Button b1; String status=””; LoginFrame() { this.setVisible(true); this.setSize(500,500); this.setBackground(Color.green); this.setTitle(“Login…
Read MoreMonth: July 2015
Create a Tic tac toe game using c++
The following program is the source code of a game called tic tac toe. The program is implemented using c++. Code : #include<iostream>#include<windows.h>using namespace std;char a[9]={‘1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9’};char c1,c2;void draw_board(){ cout<<“nn”; cout<<” “<<a[0]<<” | “<<a[1]<<” | “<<a[2]<<” “; cout<<endl<<” | | “; cout<<“n——-|——-|——-“; cout<<endl<<” “<<a[3]<<” | “<<a[4]<<” | “<<a[5]<<” “; cout<<endl<<” | | “; cout<<“n——-|——-|——-“; cout<<endl<<” “<<a[6]<<” | “<<a[7]<<” | “<<a[8]<<” “; cout<<endl<<” | | “;}int check_res(){ if(a[0]==a[1] && a[1]==a[2]) { if(a[0]==c1) return 1; else return 2; } else if(a[0]==a[3] && a[3]==a[6]) { if(a[0]==c1) return 1; else return 2; } else if(a[0]==a[4]…
Read MoreA Simple Encryption and Decryption Program [Cryptography]
In this post you can learn the basic concept of Cryptography. This program accepts a string as the input and performs encryption with the key provided by the programmer. This is a basic Encryption method so it just involves changing each single character of the String with some simple algebric operations with the key. It can be added with each and every single character of the string, so can be subtracted or divided. But note Your have to apply reverse method. Sample Outputs: The Code: #include<iostream>#include<cstring>using namespace std;void encrypt(string *s,int…
Read MorePython program to find the binary equivalent of any decimal
This is a simple program in python to find the binary equivalent of any given decimal base number. This basically takes input as a decimal base number and coverts it into binary base and prints it. Sample Outputs: The Code: def bin(x): b=”” if(x==0): #The Binary equivalent of decimal 0 is 0 b=str(0) while(x>0): b=b+str(x%2) #Typecasting an Integer to String x=x/2 b=b[::-1] #Reverse the String print binp=input()bin(inp) Description:firstly input is taken from the keyboard and stored in inp variable. Then this variable is passed to bin() from where operations are…
Read More