30/04/2016

Creating a Simple Calculator with Jquery with CSS
This is a simple calculator in Jquery and CSS(Cascading Style Sheets). It allows mostly tasks such as Addition, Subtraction, Multiplication, and Division with help of Jquery and CSS. Please follow the given step to create a calculator using jquery.

How to use it:

1. Copy the code into one folder with giving a different -2 name and at the end run the index.html file your code will be work 100%  here is a step by step explanation.

first, open a notepad and any other editor which you are using mostly  and save the given code as  index.html.

Simple Calculator using Jquery and CSS.


Code Start From Here. This is a main Index file for Calculator.

Index.html

<!DOCTYPE html>
<html>
<head>
 <title>jQuery Calculator Example</title>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 <link rel="stylesheet" type="text/css" href="reset.css">
 <link rel="stylesheet" type="text/css" href="main.css">
 <script type="text/javascript" src="calculator.js"></script>
</head>

<body>
<div id="jquery-script-menu">
<script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
<div class="jquery-script-clear"></div>
<h1 style="margin:150px auto 20px auto" align="center">jQuery Calculator Example</h1>
 <section class="container">
  <div class="calculator">
   <input type="text" readonly>
   <div class="row">
    <div class="key">1</div>
    <div class="key">2</div>
    <div class="key">3</div>
    <div class="key last">0</div>
   </div>
  <div class="row">
    <div class="key">4</div>
    <div class="key">5</div>
    <div class="key">6</div>
    <div class="key last action instant">cl</div>
   </div>
   <div class="row">
    <div class="key">7</div>
    <div class="key">8</div>
    <div class="key">9</div>
    <div class="key last action instant">=</div>
   </div>
   <div class="row">
    <div class="key action">+</div>
    <div class="key action">-</div>
    <div class="key action">x</div>
    <div class="key last action">/</div>
   </div>
   </div>
</section>
 <footer class="container">
<h1>A Simple Calculator by Ghanendra Yadav For More<a href="https://www.programmingwithbasics.com/">Click Here</a></h1>
 </footer>
    <script type="text/javascript">
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</body>
</html>

Now Open Again Editor And Save Given Code As calculator.js Code Start From Here. This is a Javascript file for Calculator.

calculator.js

$(document).ready(function(){
 //Dom is ready to let's get the fun started.
  var Calculator = {
  runningTotal : '',
  currentVal : '',
  setCurrentVal: false,
  executeAction: '',
  display: '',
  adjustTotals: function(val){
   if (!this.setCurrentVal) {
    //If this is the first number user has entered then it becomes runningTotal
    //Otherwise it becomes currentVal which will then be used to update runningTotal based on the action picked
    this.runningTotal += val;
   } else {
    //Val is a string so we can append to currentVal for multiple digits
    this.currentVal += val;
   };
  },
  add: function(){
   this.runningTotal = parseInt(this.runningTotal) + parseInt(this.currentVal);
  },
  subtract: function() {
   this.runningTotal = parseInt(this.runningTotal) - parseInt(this.currentVal);
  },
  multiply: function(){
   this.runningTotal = parseInt(this.runningTotal) * parseInt(this.currentVal);
  },
  divide: function(){
   this.runningTotal = parseInt(this.runningTotal) / parseInt(this.currentVal);
  },
  clear: function(){
   this.runningTotal = '';
   this.currentVal = '';
   this.executeAction = '';
   this.setCurrentVal = false;
   this.display = '';
  },
  resetCurrentVal: function (){
   this.currentVal = '';
  },

  calculate: function(){
   this.executeAction = '';
   this.currentVal = '';
   return this.runningTotal;
  },
  getAction: function(val){
    var method = '';
   switch (val) {
    case '+':
     method = Calculator.add;
     break;
    case '-':
     method = Calculator.subtract;
     break;
    case 'x':
     method = Calculator.multiply;
     break;
    case '/':
     method = Calculator.divide;
     break;
   }
    return method;
  },
  setDisplay: function(){
   return this.display = this.currentVal == '' ? this.runningTotal : this.currentVal;
  }
 };
 var onButtonPress = function (){
  var that = $(this),
   action = that.hasClass('action'),
   instant = that.hasClass('instant'),
   val = that.text();
  if (!action) {
   //No action means the button pressed is a number, not an "action"
   Calculator.adjustTotals(val);
  } else if(!instant) {
   //An action button was pressed. Store the action so it can be executed later
   if (Calculator.executeAction != ''){
    Calculator.executeAction();
   };
    Calculator.executeAction = Calculator.getAction(val);
   Calculator.setCurrentVal = true;
   Calculator.resetCurrentVal();
  } else {
   //Either = or Clr is clicked. this needs immediate action.
   if (Calculator.executeAction != ''){
    Calculator.executeAction();
   };
    switch (val){
    case 'cl':
     method = Calculator.clear();
     break;
    case '=':
     method = Calculator.calculate();
     break;
   }
  }
   Calculator.setDisplay();
 }
  var refreshVal = function(){
  $('.calculator input[type=text]').val(Calculator.display);
 }
  $('div.key').click(function(){
  //We want this to stay as div.keyin the onButtonPress function
  onButtonPress.call(this);
  refreshVal();
 });
});

Now Open Again Editor And Save As main.css, This is a main CSS file for Calculator.

main.css

*,
*:after,
*:before {
 box-sizing: border-box;
 -moz-box-sizing: border-box;
 -webkit-box-sizing: border-box;
}
*:before, *:after {
 display: table-cell;
 content: '';
}
*:after{
 clear: both;
}
body{
 font-family: Helvetica, Arial, sans-serif;
}
.container {
 margin: 0 auto;
 width: 350px;
}
.calculator {
 padding: 10px;
 margin-top: 20px;
 background-color: #ccc;
 border-radius: 5px;
 /*this is to remove space between divs that are inline-block*/
 font-size: 0;
}
.calculator > input[type=text] {
 width: 100%;
 height: 50px;
 border: none;
 background-color: #eee;
 text-align: right;
 font-size: 30px;
 padding-right: 10px;
}
.calculator .row {
 margin-top: 10px;
}
.calculator .key {
 width: 78.7px;
 display: inline-block;
 background-color: black;
 color: white;
 font-size: 1rem;
 margin-right: 5px;
 border-radius: 5px;
 height: 50px;
 line-height: 50px;
 text-align: center;
}
.calculator .key:hover{
 cursor: pointer;
}
.key.last{
 margin-right: 0px;
}
.key.action {
 background-color: #646060;
}
footer {
 font-style: italic;
 padding-top: 35px;
text-align: center;
font-size: 10px;
}
h1, h3, h4, h5, p {
margin-bottom: 30px;
}

Now Again Follow the Same Step And Save As reset.css, This is a reset CSS file for Calculator.

reset.css

html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}
body{line-height:1}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}
nav ul{list-style:none}
blockquote,q{quotes:none}
blockquote:before,blockquote:after,q:before,q:after{content:none}
a{margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent}
ins{background-color:#ff9;color:#000;text-decoration:none}
mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}
del{text-decoration:line-through}
abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}
table{border-collapse:collapse;border-spacing:0}
hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}
input,select{vertical-align:middle}


Now you complete all the steps now open index.html your program is working with your compatible browser here is a output if you want more program Click Here

Output:-

Addition Output:-
Input =12345+12345=24690

how to make calculator in jquery and html addition

Subtraction Output:-


24690-12345=12345

build a simple calculator using Jquery and HTML Substraction

Multiply Output:-

12345*10=123450

build a simple calculator using Jquery and HTML multiplication

Divide Output:-

123450/100=1234.5

build a simple calculator using Jquery and HTML Devide

What happened if we divide 0/0=NaN (Not A Number )

simple calculator using Jquery, CSS and HTML operations

29/04/2016

C Program For Create An Array In Structure
Problem:- Write A Program To Create Array of Structure in C Language or how to create an array of structures in c or Array of structures in C or How do you make an array of structs in C? or C array of structure or Array of Structure in C Programming or Array of Structure in C, Array within Structure in C or C Program to Store Information of Students Using Structure or Example of using array of structure or How to create an empty array of structs?.

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

What Is An Array?

An Array is a collection or group of similar data type. or we can say that an array is used to store the similar data or same type of data. An Array index starts with zero and ends with n-1 here n is a size of an array.

What Is Structure

The structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record. The structure is used to represent a record. Suppose you want to store a record of Student which consists of student name, address, roll number and age.

Defining a structure

struct keyword is used to define a structure. struct define a new data type which is a collection of different type of data.

Syntax :

struct structure_name

{
//Statements
};


Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.



Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.

Solution:-


#include<stdio.h>
#include<conio.h>

struct student
{
int roll_no;
char name[15];
};

int main()
{
int counter;
int size=3;
struct student s[size];

for(counter=0;counter<3;counter++)
{
printf("Enter The Name And Roll No. of Student %d\n",counter+1);
scanf("%s%d",s[counter].name,&s[counter].roll_no);
}

printf("\n\n"); 

for(counter=0;counter<3;counter++)
{
printf("Name \t%s\t Roll no. \t%d\n",s[counter].name,s[counter].roll_no);
}

}


25/04/2016

Build HTML Video Player Support SD, HD, FHD, UHD Resolution
HTML5 video player which support multiple video resolution sd (standard deviation), HD (high deviation), FHD (full high deviation), UHD (ultra-high deviation) when we click the button it should change the size according to its resolution you also can change video path by giving a name with extension. Save the code as given the suggested name "htmlplayer.html". remember file name extension should be .html or .htm. 

Tip:- This code is not converting videos, this is just increasing the length and width of the video, so don't be confused.

HTMLPLAYER.html


<!DOCTYPE html>
<html>
<body>

<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">SD</button>
<button onclick="makeSmall()">HD</button>
<button onclick="makeNormal()">FHD</button>
<button onclick="makeNormal1()">UHD</button>
<br><br>
<video id="video1" width="360">
<source src="aa1.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
</div>

<script>
var myVideo = document.getElementById("video1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}

function makeBig() {
myVideo.width = 480;
}

function makeSmall() {
myVideo.width = 720;
}

function makeNormal() {
myVideo.width = 1080;
}

function makeNormal1() {
myVideo.width = 2160;
}
</script>

<p>HTML5 Video Player By <a href="http://www.programmingwithbasics.com/" target="_blank">Ghanendra Yadav</a>.</p>
</body>
</html>


Output:-
                                                 Video Playing In 360 Px

free html5 SD video player

                                                     Video Playing In SD 480 Px


free html5 video player,

                                                       Video Playing In HD 720 Px


html player for website pwb

                                                  Video Playing In FHD 1080 Px


html5 player for website pwb support SD, HD, DVD

                                                        Video Playing In UHD 2160 Px


html media player support upto 4K videos

Create Javascript Program to Make a Light Bulb Turn on and Off
Create A HTML Page With JavaScript When We Click The Light Bulb To Turn On/Off The Light.
When We Click A Button JavaScript Change The Image So We Think Bulb Is On Again Click The It Again Change The Image So Bulb Look Like It Is off This Is A Trick Behind Bulb On/off

For This Program You Have To Download Both Image Bulb On And Bulb Off

Here Is A Code

bulb.html


<!DOCTYPE html>
<html>
<body align="center" bgcolor="#686899">
<h1>JavaScript Can Change Images</h1>

<img id="myImage" onclick="changeImage()" src="pic_bulboff.gif" width="100" height="180">

<h2>Click the light bulb to turn on/off the light.</h2>
<script>

function changeImage() {
var image = document.getElementById('myImage');
if (image.src.match("bulbon")) {
image.src = "pic_bulboff.gif";
} else {
image.src = "pic_bulbon.gif";
}
}

</script>
</body >
</html>


Output:-
light bulb off javascript

light bulb on javascript

24/04/2016

Palindrome Number Program in Javascript
Create a javascript program to perform a palindrome test. Before understanding the logic of palindrome in javascript we need to understand what is a palindrome. Below is the definition of palindrome with examples. JavaScript Program to find Palindrome pwb, palindrome javascript by programmingwithbasics, Javascript Palindrome Check.

What is palindrome

A palindrome is a word, phrase, number, or another sequence of characters which reads the same backward or forward. Allowances may be made for adjustments to capital letters, punctuation, and word dividers. Examples in English include "a man, a plan, a canal, Panama!", "Amor, Roma", "race car", "stack cats", "step on no pets", "taco cat", "put it up", "was it a car or a cat i saw?" and "no 'x' in Nixon".

Create A HTML WebPage Using JAVASCRIPT For Check Given String In Palindrome Or Not

In Hindi:- "उल्टा सीधा एक समान" or "Ulta Seedha Ek Samaan"

Javascript Palindrome Code start from here


<html>
<head>
 <meta charset = "UTF-8">
 <title>Palindrome</title>
 <style type="text/css">
  body
  {
   font:10px sans-serif;
  }
 </style>

 <script type="text/javascript">
  function palindrome()
  {
   var initial = prompt("Please enter a 5 digit string to check whether it is a palindrome:", "");
   var palin = new Array();
   while (initial.length != 5)
   {
    alert("You did not enter a 5 character digit! All palindromes that this calculator can solve are 5 digits!")
    initial = prompt("Please enter a 5 digit string to check whether it is a palindrome:", "");
   }
   for (var i = 0; i <= initial.length -1; i++) {
    palin[i] = initial.charAt(i);
   };
   if (palin[0] == palin[4])
   {
    if (palin[1] == palin[3])
    {
     document.write("The number that you entered was " + initial + ".");
     document.write("<br>This number is a palindrome!")
    }
   }
   else
   {
    document.write("The number that you entered was " + initial + ".");
    document.write("<br>This number is NOT a palindrome!")
   };
  };
 </script>
</head>
<body align="center" bgcolor="aqua">
 <p><h2> Enter a 5 digit string to check whether an the string is a palindrome.</p></h2><br>
 <p><h2> A palindrome is a number that reads the same backwards and forwards. </h2></p1>
 <hr>
 <input type = "button" id = "palindrome" value = "Click to start the program"  onclick = "palindrome();" />
</body>
</html>

Output:-


Javascript Palindrome

Javascript Palindrome taking input

Javascript Palindrome test output of a number


Number Is Not Palindrome Example


Number is not Palindrome in Javascript output


23/04/2016

Javascript Program to Find the Sum, Average, Smallest and Largest Number of an Array.
Create an array using javascript that calculates a sum, average, smallest, and largest element in the array. So basically array has fixed size and we have to find the only sum of all the elements, an average of all the numbers, smallest number of an array and the largest number of an array. there is 4 task to solve this problem. As we know that for finding a sum of all the number we have to traverse zero indexes to the last index of an array and add all those numbers and same procedure for find average of a number only difference is that we have to divide the sum by number of elements, and for smallest and largest number we have to compare a number with all existing number of an array and in the number is small compared to the other number that we get a smallest elements or number of an array if the number is greater than we get the largest elements of number of an array.

If you find any difficulty to please comment below.

Javascript code for find Sum, Average, Smallest and largest Number.


<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Array Processing</title>
<script>

function doProcess() {
var fields=document.forms[0].getElementsByTagName('INPUT');
var val=0;
var min=0;
var max=0;
var total=0;

for (var i=0;i<fields.length;i++) {
if ((fields[i].type=='text')&&(fields[i].name.indexOf('number')==0)) {
val=parseInt(fields[i].value);
if ((val<0)||(val>100)) {
alert('only numbers between 0 and 100!');
return false;
}

if (isNaN(val)) {
alert('All fields have to contain numbers');
return false;
}
total+=val*1;
if (val>max) max=val;
if (val<min) min=val;
}

}
document.forms[0].sum.value = total;
document.forms[0].average.value = total / 10;
document.forms[0].smallest.value = min;
document.forms[0].largest.value = max;
}
</script>
</head>

<body align="center">
<h1>Array Processing</h1> <br>
<h3>Enter The Number Between 0 To 100 </h3> <br>
<form method = "post" action = "/cgi-bin/formmail" >
<input name = "number0" type = "text" size = "4"
maxlength = "5" />
<input name = "number1" type = "text" size = "4"
maxlength = "5" />
<input name = "number2" type = "text" size = "4"
maxlength = "5" />
<input name = "number3" type = "text" size = "4"
maxlength = "5" />
<input name = "number4" type = "text" size = "4"
maxlength = "5" />
<input name = "number5" type = "text" size = "4"
maxlength = "5" />
<input name = "number6" type = "text" size = "4"
maxlength = "5" />
<input name = "number7" type = "text" size = "4"
maxlength = "5" />
<input name = "number8" type = "text" size = "4"
maxlength = "5" />
<input name = "number9" type = "text" size = "4"
maxlength = "5" />
<br><br>
<input type="button" name="click1" value="Process" onClick="doProcess()">
<p>
<label>Sum:
<input name = "sum" type = "text" size = "4"
maxlength = "10" />
<label>Average:
<input name = "average" type = "text" size = "4"
maxlength = "10" />
<label>Smallest:
<input name = "smallest" type = "text" size = "4"
maxlength = "10" />
<label>Largest:
<input name = "largest" type = "text" size = "4"
maxlength = "10" />
</form>
</body>
</html>

Output:-

Javascript Array sum, average, smallest and largest number output
Create A HTML Page With Rollover With A Mouse Events
Create A HTML Page With Rollover With A Mouse Events When We Enter The Mouse In Image .Image Should Be Change To Another Image And When We Mouse Out From Image Previous Image Should Be Display 

 Code Start Here

Hover.html

<html>
   
   <head>
      <title>Rollover with a Mouse Events</title>
      
      <script type="text/javascript">
         
            if(document.images){
               var image1 = new Image(); // Preload an image
               image1.src = "turndown.gif";
               var image2 = new Image(); // Preload second image
               image2.src = "nit.gif";
            }
      </script>
      
   </head>
   
   <body>
      <p>Move your mouse over the image to see the result</p>
      
      <a href="#" onMouseOver="document.myImage.src=image2.src;" onMouseOut="document.myImage.src=image1.src;">
      <img name="myImage" src="nit.gif" />
      </a>
   </body>
</html>

Output:-

Before Enter A Mouse In Image

www.programmingwithbasics.com

After Enter Mouse In Image 


www.programmingwithbasics.com

Create A HTML Page Insert A Image And Button In Page When A Click To A Button Image Should Shifted To Right Until Stop Button Not Press
Create A HTML Page Insert A Image And Button In Page When A Click To A Button Image Should Shifted To Right Until Stop Button Not Press

NOTE: When Double Click On the Start Button It Speed Should Be Double As So On There are a lot of possibilities for people who want to change something in the interior design of their houses. If you want to change the style of the whole room, colour scheme, lighting type, or furniture, with https://www.prints4sure.com you can do it with ease.

Code Start Here

Click.html

<html>
   
   <head>
      <title>JavaScript Animation</title>
      
      <script type="text/javascript">
         <!--
            var img = null;
            var animate ;
            
            function init(){
               img = document.getElementById('myImage');
               img.style.position= 'relative'; 
               img.style.left = '0px'; 
            }
            
            function moveRight(){
               img.style.left = parseInt(img.style.left) + 10 + 'px';
               animate = setTimeout(moveRight,20); // call moveRight in 20msec
            }
            
            function stop(){
               clearTimeout(animate);
               img.style.left = '0px'; 
            }
            
            window.onload =init;
         //-->
      </script>
      
   </head>
   
   <body>
   
      <form>
         <img id="myImage" src="Desert.jpg" height="400" width="600" />
         <p>Click the buttons below to handle animation</p>
         <input type="button" value="Start" onclick="moveRight();" />
         <input type="button" value="Stop" onclick="stop();" />
      </form>
      
   </body>
</html>

Output:-

www.programmingwithbasics.com


www.programmingwithbasics.com

Calculates the Distance Between Two Points X1, Y1, and X2, Y2 in Javascript
Javascript Program to calculate the distance between two points, write a javascript function distance that calculates the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be floating-point values. Incorporate this function into a script that enables the user to enter the coordinates of the points through an HTML form or compute the distance between two points taking input from the user in javascript. Follow the step to get a distance between two points.

Step 1: First we create a form that can hold up to 4 values each point have 2 values x1 and y1 or x2 and y2.

Step 2: After that, we will perform some mathematics operations on those value and store the result in another variable.

Step 3: Now we have a result or distance of two points, now the next step is to display the result.

Step 4: Display the result of the two-point distance in javascript popup, and according to the question requirements we have to use float number to display a value.

As we all know that to calculate any equation e need the formula to find the result so for finding a distance of two number we are using the following formula that can help to calculate a distance between two points of two objects.

The formula of Calculating Distance between two point 

Formula to calculate a distance between two points X1, Y1, and X2, Y2

javascript code to calculate a distance between two points


Copy the code and save a file as distence.html or distence.htm. Extension should be .html or .htm both are accepted.


<!DOCTYPE html>
 <head>
<title>javascript get distance between two points</title>
//Javascript script start from here.
 <script>
 function find_distance()
 {
 var x1=parseInt(document.getElementById("x1").value);
 var y1=parseInt(document.getElementById("y1").value);
 var x2=parseInt(document.getElementById("x2").value);
 var y2=parseInt(document.getElementById("y2").value);
 var distance=Math.sqrt(Math.pow((x1-x2),2)+Math.pow((y1-y2),2));
 alert("Distance: "+distance);
 }
 </script>

 </head>
 <body>
 <form name="f1" method="post">
 <label>Enter the co-ordinate of point p:</label><br>
 x1:<input type="text" id="x1" size="30"/>&nbsp;y1:<input type="text" id="y1" size="30"/><br>
 <label>Enter the co-ordinate of point q:</label><br>
 x2:<input type="text" id="x2" size="30"/>&nbsp;y2:<input type="text" id="y2" size="30"/><br>
 <button onclick="find_distance()">Find Distance</button>
 </form>
 </body>
</html

Output:-

find distance between two points in javascript
Write A Complete JavaScript Program To Calculate And Display The Volume Of The Sphere
Write a complete JavaScript program to prompt the user for the radius of a sphere, and call function sphereVolume to calculate and display the volume of the sphere. Use the statement? Volume = ( 4.0 / 3.0 ) * Math.PI * Math.pow( radius, 3 ); to calculate the volume. The user should input the radius through an HTML text field  
And click an XHTML button to initiate the calculation.

Copy Code From Here

Radius.html


<html>
<head><title>pro4</title>
<script>
function volume()
{
var t_val=document.getElementById("txt").value;
var rad=parseInt(t_val);
var vol=(4.0/3.0)*Math.PI*Math.pow(rad,3);
alert("Volume= "+vol);
}
</script>
</head>
<body>
<label>Enter the radius of Sphere: </label>
<input type="text" id="txt" size="30"/><br>
<button onclick="volume()">Find volume</button>
</body>
</html>

Output:-

www.programmingwithbasics.com

Create an XHTML document that allows prospective students to provide feedback
Problem:- A local university has asked you to create an XHTML document that allows prospective students to provide feedback about their campus visit. Your HTML document should contain a form with text boxes for a name, address, and e-mail. Provide checkboxes that allow prospective students to indicate what they liked most about the campus. The checkboxes should include: students, location, campus, atmosphere, dorm rooms and sports. Also, provide radio buttons that ask the prospective students how they became interested in the university. Options should include friends, television, Internet, and other. In addition, provide a text area for additional comments, a submit button and a reset button.

How to Solve:- Just follow the instruction given in problem statement and design according to the requirement as we can see that in this problem we have to design a College feedback form. We also know that college has many activity and part. So see the Explanation section for code design.

Elements are used in Design

1. List
2. Radio Button
3. Checkbox
4. Textarea
5. Submit Button
6. Email

Explanation:- First we have to use the name, Email, and address and after that, there is question according to the question we have to design a web page as for first question checkbox is necessary cause there may be many areas you visited in college and you like it. The second question is how to become interested in university/college so people should have an option so this is the second phase of our design and last is a comment for any suggestion and complain after all this click on Submit button. this is like a participating in a Survey.

Tip:-  Always create a folder for separate web page file for avoiding unnecessary mixing and irritating. Check the Output below of the program. If you are having any problem highly recommended following the given web page.

Recommendation:- Before going for this assignment follow the given assignment so you can understand all Tags very well.

1. Create An HTML Page With Different Types Of Frame Such As Floating Frame Navigation Frame, Mixed Frame In HTML

2. Create A Student Registration Form Using Table  In HTML

Note:- If you have a Better design than this page and you want to publish your post with all Credit Than you are welcome to read This.

Solution:-

Copy Start From Here

University.html

<html>
 <head><title>Campus Visit</title>
 </head>
 <body>
 <form name="std_details" method="post">
 <label>Name:</label>
 <input type="text" size="50"><br><br><br>
 <label>Address</label>
 <textarea height="5" width="50"></textarea><br><br>
 <label>Email</label>
 <input type="email"/><br><br>
 What are things that you like:<br><br>
 <ul>
 <li><input type="checkbox" name="camp">Campus</li>
 <li><input type="checkbox" name="camp">Location</li>
 <li><input type="checkbox" name="camp">Student</li> 
 <li><input type="checkbox" name="camp">Atmosphere</li>
 <li><input type="checkbox" name="camp">Dorm Room</li>
 <li><input type="checkbox" name="camp">Sport</li>
 </ul><br>
 How to became interested in university:<br><br>
 <ul>
 <li><input type="radio" name="iu">Friends</li>
 <li><input type="radio" name="iu">Television</li>
 <li><input type="radio" name="iu">Internet</li>
 <li><input type="radio" name="iu">Others</li>
 </ul>
 <br>
 Comment<br><br>
 <textarea height="5" width="50"></textarea><br>
 <button>Submit</button>
 </form>
 </body>

</html>

Copy Ends Here

Output:-


Create an XHTML document that allows prospective students to provide feedback


You Should See

1. Design A Page. The Page Must Be Useful For Colleges For Updating Daily Activities And Students Information

2.Build A Simple Calculator Using HTML Form Elements And JavaScript.

3.Write A JavaScript That Calculates The Squares And Cubes Of The Numbers From 0 To 10 And Outputs XHTML Text That Displays The Resulting Values In An XHTML Table Format, As Follows: Number Square Cube

4. Write A Program That Inputs An Encrypted Four-Digit Integer And Decrypts It To Form The Original Number.


5. Write A Complete JavaScript Program To Calculate And Display The Volume Of The Sphere


Create a HTML Document Using Frame Which Should Satisfy All Given Requirements
Problem:- Create an HTML document that has five frames. There must be two rows of frames, the first with three frames and the other with two frames. The frames in the first row must have equal width. The left frame in the second row must be 50 percent of the width of the display. Each of the frames in the top row must display a document that has a form. The left top frame must have two text boxes, each 30 characters wide, labeled Name and Address. The middle top frame must have five radio buttons with color name labels. The right top frame must have four checkboxes, labeled with four kinds of car equipment such as CD player and air conditioning. The two bottom frames must have images of two different cars. The top row of frames must use 20 percent of the height of the display

How to Solve:- There is no logic we just have to use the different types of the frames on our web page. frames are especially cause it makes our web page more useful. Before going for direct use of frames I recommended read the explanation section for better understanding.

Explanation:- We have to divide our web page to 2 row and first-row further divide into 3 part and the second row divides into 2 part. Now as problem requirement first row and first column design username, password and two buttons Sumit a reset button and go to first-row middle part design a radio button for various options and last in the first row and third column design checkbox for multiple choice. Now the first-row work is completed come to the second-row first column insert an image and repeat the same thing with the second row with the second column. Hence you have done check this for each section design separate part of HTML file and link with them internally.

Tip:- Always create a folder for separate web page file for avoiding unnecessary mixing and irritating and one more thing is important that always care about scrollbar in frames. Check the Output below of the program. If you are having any problem highly recommended following the given web page.

Recommendation:- Before going for this assignment follow the given assignment so you can understand all Tags very well.

1. Create an HTML page named as " SimpleTags.html ". with following tags details

2. Create A Student Registration Form Using Table  In HTML

Note:- If you have a Better design than this page and you want to publish your post with all Credit Than you are welcome to read This.

Solution:-

Copy Start From Here

Index.html

<html>
<head>
<title>My WebPage</title>
</head>

<frameset  rows="20%,*">
<frameset cols="33%,33%,*">
 <frame name = "a" src="login1.html">
 <frame name = "b" src="b.html">
 <frame name = "c" src="c.html">

</frameset>

<frameset cols="50%,*">
 <frame name="d" src="d.html">
 <frame name="e" src="e.html">
</frameset>
</frameset>
</html> 

Login.html

<html>
<head>
<title>PAGE 1</title>
</head>
<body align="center" bgcolor="#00bbba">
USER NAME<input type "textbox" size="16" > <br><br>
PASSWORD<input type "password" size="16" > <br><br>
<button type="button">SUBMIT</button> 
<button type="button">RESET</button>
</body>
</html>

Radio.html

<html>
<head>
<title>PAGE 2</title>
</head>
<body bgcolor= "aqua" >
<input type="radio" name="A" value="gasoline"><font size="4">GASOLINE</font><br>
<input type="radio" name="A" value="patrol"><font size="4">PATROL</font><br>
<input type="radio" name="A" value="diesel"><font size="4">DIESEL</font><br>
<input type="radio" name="A" value="gas"><font size="4">GAS</font><br>
<input type="radio" name="A" value="other"><font size="4">OTHER</font><br>
</body>
</html>

Checkbox.html

<html>
<head>
<title>PAGE 3</title>
</head>
<body>
<input type="checkbox" name="A" value="air conditioner"><font size="5">AIR CONDITIONER</font><br>
<input type="checkbox" name="A" value="tire"><font size="5">TIRE</font><br>
<input type="checkbox" name="A" value="light"><font size="5">LIGHT</font><br>
<input type="checkbox" name="A" value="cd player"><font size="5">CD PLAYER</font>
</body>
</html>

Img1.html

<html>
<head>
<title>Page 5</title>
</head>
<body bgcolor= "blue" >
<img src="b.jpg" border="3" height ="500" width="690" >
</body>
</html>

Ima2.html

<html>
<head>
<title>Page 4</title>
</head>
<body bgcolor= "green" >
<img src="a.jpg" border="3" height ="500" width="690" >
</body>
</html>

Copy Ends Here

Output:-



15/04/2016

C Program to Store Student Information Using Structures And Pointer
Problem:- Write A C Program to Store Information Using Structures With Pointer With Dynamically Memory Allocation In Structure In C or c program to store information of 10 students using structure or c program to store information using structures with dynamic memory allocation or dynamic memory allocation for structures in c or dynamic memory allocation in c programming examples or c program using structures employee details or dynamic memory allocation for array of structures in c or memory allocation for structure members in c or c program examples using structures.

What Is Pointer?.

The pointer is a variable which holds the address of another variable. If you want to practice more on pointer question Click here.

Defining a structure

struct keyword is used to define a structure. struct define a new data type which is a collection of different type of data.

Syntax :

struct structure_name
{
//Statements
};

Solution:-

#include <stdio.h>
#include<stdlib.h>
struct name {
   int a;
   char c[30];
};
int main(){
   struct name *ptr;
   int i,n;
   printf("Enter The No. : ");
   scanf("%d",&n);

/* Allocates the memory for n structures with pointer ptr pointing to the base address. */
   ptr=(struct name*)malloc(n*sizeof(struct name));
   for(i=0;i<n;++i){
       printf("Enter string and integer respectively:\n");
       scanf("%s%d",&(ptr+i)->c, &(ptr+i)->a);
   }
   printf("Displaying Infromation:\n");
   for(i=0;i<n;++i)
       printf("%s\t%d\t\n",(ptr+i)->c,(ptr+i)->a);
   return 0;

}

Output:-


C Program to Store Student Information Using Structures And Pointer


You May Also Like


1. C Program To Insert An Element Desired or Specific Position In An Array

2. C Program For Remove Duplicates Items In An Array

3. C Program To Delete Element From Array At Desired Or Specific Position

4. C Program For Print "I AM IDIOT" Instead Of Your Name Using Array

5. C Program For Check String Is Palindrome Or Not Using For Loop

6. C Program For Convert All Input String Simultaneously Into Asterisk ( * )

7. C Program For Calculator Using Switch Case

8. C Program For Find A Grade Of Given Marks Using Switch Case

9. C Program For Finding Radius Circumference Using Switch Case

10. C Program For Remove All Vowels From A String Using Switch Case



C Program To Add Two Complex Numbers Using Structures And Functions
Problem:- C Program To Add Two Complex Numbers By Passing Structure With Function Using Structure In C or C++ Program to Add Complex Numbers by Passing Structure or Adding two complex numbers using Structure in C or C Program To Add Two Complex Numbers By Passing Structure With Function or C program to Add two Complex Numbers using structures or C program to add two complex numbers or Write a C Program to add two complex numbers by passing structure or C Program to Add two Complex Numbers or Complex Number Using Struct or C++ program to add, subtract, multiply and divide two complex or Program to add two complex numbers.

What Is Structure

The structure is a user-defined data type in C which allows you to combine different data types to store a particular type of record. The structure is used to represent a record. Suppose you want to store a record of Student which consists of student name, address, roll number and age. You can define a structure to hold this information.

Defining a structure

struct keyword is used to define a structure. struct define a new data type which is a collection of different type of data.

Syntax :

struct structure_name

{
//Statements
};

Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.

Solution:-

#include <stdio.h>
typedef struct complex
{
float real;
float imag;
}complex;

complex add(complex n1,complex n2);

int main()
{
complex n1,n2,temp;
printf("For 1st complex number \n");
printf("Enter real and imaginary respectively:\n");
scanf("%f%f",&n1.real,&n1.imag);
printf("\nFor 2nd complex number \n");
printf("Enter real and imaginary respectively:\n");
scanf("%f%f",&n2.real,&n2.imag);
temp=add(n1,n2);
printf("Sum=%.1f+%.1fi",temp.real,temp.imag);
return 0;
}

complex add(complex n1,complex n2)
{
complex temp;
temp.real=n1.real+n2.real;
temp.imag=n1.imag+n2.imag;
return(temp);
}

Output:-