Tuesday, 16 July 2013

advanced technique on logic with for loop



Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:9703619391
(india)
E-mail: vas.shrinivas002@gmail.com

To day friend ivan. Asked below prog why cannot u try this.
 1
121
1221
12221
122221
Program logic Is hear.



----------------------------start copy from below--------------------------------------------------
<html>
<body>
<script type="text/javascript">
var i,j;
for(i=1;i<=5;i++)
           {
        document.write("1");

                  for(j=1;j<i;j++)
                      {

                      document.write("2");
                            }

               if(i>1)
                  {
             document.write("1");
                     }                         
              document.write("<BR>");
            }

</script>
</body>
</html>
---------------end of copy above---------------


I want like this

1
121
1221
12221
122221
Child observed 1 is common frent and back 1 .....1
that's why we added first 1 at  starting of program and second 1added ending of program like this
document.write("1") 
-------
----
-----
-----
document.write("1");

after completed this. It should come next line that's why i used document.write("<BR>");

about 2:
Number 2 is added from second  row
you cannot see no 2 first row , added from second row that's why i used [j<i;]

Detailed:
1
121---2 came 1 time
1221---2 came 2 times
12221---2 came 3 times
122221---2 came 4 times      all these acheived with this [j<i]
                      document.write("2");

first iteration 2 cannot print becz [j<i]---1<1
second iteration 2 will print only one time becz  [j<i]---1<2 acheived with document.write("2");
next j wil increment becz of 2<2 now exit from j loop sooooooo on.....

observe this:

 for(j=1;j<i;j++)
                    {

                      document.write("2");
                            }

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
------------------------------------------------------------------------------------------------------------

You can utilize my programs in Database also[ORACLE(PLSQL)] ,MSQLSERVER.
Not only in c++,Net



Monday, 8 July 2013

advanced techniques for codeing



Author:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Hi 

freinds, just now our freind ivan asked me i want like
this


1                                                       1
11                                                      2
1111                                                   4  
11111111                                              8 
1111111111111111                                 16 
11111111111111111111111111111111       32
How to do this 

HURRY 

don't print 1 with document.write

hurry up!!!!!!!!!!!!!!!!!!!!!!!!!!!

After sometime.

Yesterday i got a message one of our freind send  below program
He told me i was unable to correct problem, Resolve it.


<html>
<body>
<script type="text/javascript">

var i, j, k=1;

for(i=1;i<=5;i++)
{

                  for(j=1; j<=k; k=k*1)
                     {
                 document.write("1");
                      }
                 document.write("<BR>");
            k=k+k;

}




</script>




</body>
</html>




Then i started correcting see changes below.

---------------copy starts from below---------------------------------------------


<html>
<body>
<script type="text/javascript">

var i, j, k=1;

for(i=1;i<=5;i++)
{

                  for(j=1; j<=k; j=j+1)
                     {
                 document.write("1");
                      }
document.write("-------> "+k);

document.write("<BR>");


            k=k+k;

}




</script>




</body>
</html>


------------------------COPY ENDS ABOVE-----------------------------------------------------------
You can use above technique any were c,c++,java,.NET......
Hear LOGIC is important. You can use this anywere

How to understand above programm.



             Few days back me and my son went to bakery to purchase chocolates.



Their he found rates 



1) 1/- Rs for biscuit

                                   

2) 2/- Rs for chocolate



3) 4/- Rs for Bun



4) 8/- Rs for veg puff



5) 16/-Rs for veg roll



6) 32/-rs for Mango juice



He murmuring i asked what???? He replied double, Dad i am counting price. 


1
1+1(2)
2+2(4)
4+4(8)
8+8(16)
16+16(32)


I said u r correct.

----------------copy start from below---------------------------------------------

<html>
<body>

<script type="text/javascript">

var listofitems,j;

var soncount=1;


for(listofitems=1;listofitems<=6;listofitems++)

    {

           for(j=1;j<=soncount;j++)

                    {


                  document.write("1");

                        }
                    document.write("---------> "+soncount);

                    document.write("<BR>");
              
                    
                 soncount=soncount+soncount;


    }


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


------------------------------copy end above --------------------------------------
Listofitems =6

soncount
1---------------------------------------Initially he starts from soncount=1
1+1(2)------------------second round-------soncount=soncount+soncount
2+2(4)------------------third round----
soncount=soncount+soncount4+4(8)
8+8(16)-----------------fourth round--soncount=soncount+soncount 8+8(16)
16+16(32)--------------fifth round----soncount=soncount+soncount 16+16





----------------------------------------------------------------------------------------

Logic foundation by using for loop

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Hi

Freinds  i am getting mails stating that i like your way of explanation, people added me in their fav list. day by day i am getting more likes.

Few days back one of my viewer  greet me. Congrats one of your content selected by software GAINT microsoft.Content is

http://javascriptwithshrinivas.blogspot.com/2013/05/how-to-implement-sorting.html

Thanks  to viewers and respectable citizens of whole nations.


next is

print even numbers




<html>
<body>
<script type="text/javascript">

var lenin;

document.write("Even numbers"+ " ");

for(lenin=2; lenin<=16;lenin=lenin+2)

{
document.write(lenin+ " ");
}

</script>

</body>

</html>



explanation 

I took variable lenin and assigned 2 in that like lenin=2

dear you now that by adding 2 to previous number you can get even number
like this lenin=lenin[previous number]+2---------> [lenin=2+2] now 4


so on

6 8 10 12 14 16


next follow below
http://javascriptwithshrinivas.blogspot.com/2013/07/advanced-techniques-for-codeing.html

Saturday, 6 July 2013

more on logic using for loop


Authour:I will teach you courses online
C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
We want like this
1
1 1
1 1 1
1 1 1 1
1 1 1 1 1

Few days back I  brought vegetables.
My son is playing with tomatoes; he asked what these dad are. I replied to him tomatoes he said ohhh tomato

At that moment I have given tomatoes like this, and he arranged very neatly.

First time I given one tomato
Second time two tomatoes
Third time three tomatoes
Fourth time four tomatoes
Fifth time five tomatoes



he arranged like below




Logic is below

Copy start from below 

<html>
<body>

<script type="text/javascript">

var dad,son;

for(dad=1;dad<=5;dad++)
           
             {

                       for(son=1; son<=dad;son++)

                                  {
                                   
                          document.write("1");
                                  }

                            document.write("<BR>");
}



</script>

</body>
</html>

-----------------------copy ends above--------------------------------------------------
Understand this:

dad condition is 5 [dad<=5] rounds, for every round dad will increase

son listen dad voice he did not ask more tomatoes so son condition is[son<=dad]


Starts from hear:


First time dad given one tomato like this [dad=1;dad<=5]

above dad variable contains 1 tomato [assume in dad hand 1 tomato and condition is satisfied 1<=5]

now dad  put 1 tomato in son hand 

now sun part

now sun variable  contains 1 tomato

becz he listen dad voice like this son<=dad[1<=1]

in first row he put tomato on floor like this 

row 1--->.


next second round

dad variable contains 2 tomatoes why dad++[dad incremented, dad taken two tomatoes second round]

and condition satisfied dad<=5[2<=5]

now son part

dad given first tomato for second row

sun variable contains 1 tomato in his hand [sun=1]
and condition is satisfied 1<=dad[1<=2]

row 2---->.

 next son++[son incremented] son excepted second tomato
 taken second tomato from father, condition is satisfied son<=dad[2<=2]

he put second tomato on floor now row 2 contains two tomatoes
  

row 2---->..

like that sun continued 

Third time three tomatoes
Fourth time four tomatoes
Fifth time five tomatoes

like that son arranged see how sweetly he arranged

in place of tomato you can assume 1

now output is 

1
11
111
1111
11111

------------------------THANK YOU FOR ALL----------------------------------------

This time i am expecting child[son],He is womb of her mother. Please bless me.



Thursday, 4 July 2013

how to implement logic with for loop


Authour:I will teach you courses online
C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:9703619391 E-mail: vas.shrinivas002@gmail.com
We want like this

1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1


Story:

Few days back in our house we have celebrated our brother birthday.
My uncle instructed their are 5 steps are their, Arrange 5 chairs in each step.

He Expected 20 people today.

We arranged neatly came out, See below how we arranged.



Details explanation:

Step one-1 1 1 1 1--------five chairs
Step two-1 1 1 1 1--------five chairs
Step three-1 1 1 1 1--------five chairs
Step four-1 1 1 1 1--------five chairs
Step five-1 1 1 1 1-------five chairs

HEAR IS CODE
START COPY FROM BELOW IN NOTEPAD AND RUN IT BEFORE RUN SAVE AS HTM FILE

<html>
<body>
<script type="text/javascript">
var steps,chairs;


for(steps=1;steps<=5;steps++)
{

             for(chairs=1;chairs<=5;chairs++)

                          {

              document.write(" 1 ");

                              }
                       
                   document.write("<BR>");
}
</script>
</body>
<html>
------------------------- COPY END HEAR ----------------------------------
Continue with next post
http://javascriptwithshrinivas.blogspot.com/2013/07/more-on-logic-using-for-loop.html

Today try this How to write letter b in javascript



Authour:-I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Today also small test for users, Write Letter B in javascript.

You tried alot then try this. I have allready written in C language.


http://corcppwithshrinivas.blogspot.com/2013/04/how-to-write-letter-b-with-c.html

Wednesday, 3 July 2013

Today try this How to write letter v in javascript

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com


My dear freinds today try this, Write letter V in javascript

If you tried alot not able, No problem i have allready written in c Use this.

http://corcppwithshrinivas.blogspot.in/2013/04/writing-letter-v-with-c-language.html

Tuesday, 2 July 2013

switch statement


Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
--------------------------------------------------------------------------------------------
Switch works like START button in windows 7, If you click control panel automatically cp[control panel] will open.

Same way switch will work

switch(button)  {
case "next":
window.location="next.html";
break;

case "previous":
window.location="prev.html";
break;

case "home":
window.location="home.html";
break;

default:
window.alert("Wrong button.");

}


contd after lunch..................with deeeeeep explanation.
-----------------------------------------------------------------------------------------

Monday, 1 July 2013

multiple if and else


------------------------------------------------------------------------------------------------------------Like previous today you decided to go your home town, But you stuck in traffic jam.

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:9703619391 E-mail: vas.shrinivas002@gmail.com

At that moment you r thinking that IF i reach railway station at 10:00 am i can catch train, else   11:00 am BUS  is their else 12:00 pm private traveler are their.

if (time < 10 )

document.write("I catch the train");

else if (time < 11 )

document.write("I catch the bus");

else if(time < 12)

document.write("I catch the private bus");

Other example



Let us assume that you went for run race. Before starting run race they announced if anybody wins prize is 1 lakh
                               second prize is 50 thousand
                               third prize is 25 thousand

Obviously you want 1 lakh that is 1 prize.

if(score==1)

document.write("Award is 1 laksh rupeees");

else if(score==2)

document.write("Award is 50 thousand rupeees");

else if(score==3)

document.write("Award is 25 thousand");

     


----------------------------------------------------------------------------------------------------------




Saturday, 29 June 2013

how to understand for loops in javascript

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
-----------------------------------------------------------------------------------------------------------
Few days back in summer we went to beach, I have collected few pebbles. I called my daughter given pebbles one by one.


I have given first one-1 pebble
She started counting 1pebb
Next given second one-1 pebb
She started counting 1+1 pebb=2 pebbles
Next given third one-1 pebb
She started counting 2+1 pebb=3 pebbles
Next given fourth one-1 pebb
She started counting 3+1=4 pebbles


This is foundation for FOR loop to understand.


var daughter;

for(daughter=1;daughter<=4;daughter++)
{
document.write(daughter);
}


how to understand program

var daughter:DECLARATION

DAUGHTER<=4 : FATHER IS CONDITION ,BECAUSE HE KNOWS HOW MANY PEBBLES IN HIS HAND.

DAUGHTER IS COUNTING: DAUGHTER++

var daughter;

for(daughter=1;daughter<=4;daughter++)
{
document.write(daughter);
}

for loop iteration:
first iteration  1 number->Because i have given 1 pebble-she started counting 1 pebble

second iteration 2 number->i have given another 1 pebble-she started counting 1+1=2 or[daughter++=2]

third iteration 3 number-> i have given another 1 pebble-she started counting 2+1=3 or[daughter++=3]

fourth iteration 4 number->i have given another 1 pebble-she started counting 3+1=4 or[daughter++=4]

------------------------------------------------------------------------------------------------------------
Next you can implement above methodology in your environment(c,c++,c#,java)






                 

Friday, 28 June 2013

how to understand if and else


Authour:I will teach you courses online
C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
How to understand IF and Else:

Programming means a programmer expect some scenarios, in user perspective.
Based on that we develop program-mes. Don't think it's very hard.

See below explanation-A simple way to explain if and else

Today you decided to go your hometown, Assume that sometimes it will happen. While riding bike you have decided IF i luckily catch the train it's ok ELSE it's better to go by BUS. You rushed to railways station, you were all ready late. Then already option chosen by you that is BUS.

So real world you are a big programmer, I am right.

See this

if (train==their)

{
alert("Travel by train")

}

else

{
alert("Travel By BUS");

}


Niece explanation isn’t it. Again don't add my in your fans list.

If(i==5)
{
alert(“Target reached”);
}
Else
{
  Alert(“Try again”);


}

Very Simple.


Take my knowledge and improve yourself.

if and else

if(a==1)
{
alert("Yes a 1");
a=0;
}
else
{
alert("Some other value: " + a);
}

By reading above explanation you can easily understand this.

Next how to understand multiple if and else 






.
.

Monday, 24 June 2013

Thanks to Readers



Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Dear Readers,



Becz of Readers our blog reach the sky by hitting  the floor. I am very much happy because my unique content is selected by bing.com [Microsoft].

Microsoft Gives me a great place in society, Future I will work for you very hard (clever)

I will appear with new innovative thoughts. Like below




Once again thank you to all people, who are watching my blogs.

See results :1020000- Out of 1020000 we came first.

























Milestone today:on 25 th of 6 2013 out of 1040000 results we came first
Milestone today:on 27 th of 6 2013 out of 1040000 results we came first

Created sensational today out of 1060000 RESULTS we came first today, Eventhough Results increased[Adding new websites] we came FIRST, 

 DAYONE OUTOF 1020000: WE CAME FIRST
 NEXT ON 25TH OUTOF 1040000:WE CAME FIRST
 TODAY ON 28TH OUTOF 1060000:WE CAME FIRST, Enjoy  GLORIOUS VICTORY.
HIP HIP HURRAY HURRAY

Again and again TODAY ON 29TH OUTOF 1060000:WE CAME FIRST, FEELING IS ENDLESS
THANK YOU TO ALL  


On 01/July/2013 stats saying that we are top of world, Enjoy glorious victory
Our success is endless. Proud to say we are top of world out of 1060000 websites
Thank you to all.

on 7/2/2013
Thanks to readers  becz of you today our blog became popular in any search engine you can found our blog any where, Thanks to Microsoft selecting my unique code. Still we are top of world.

 







Thursday, 13 June 2013

Introducing Objects



Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Objects r two types

DOM objects and Built-in objects, We have all ready see about Date dom objects in previous chapters, If not click on below link.


Although JavaScript’s variables and arrays are most convenient to store data. Sometimes you need big database. Like business card database, because every business card contains names, phone numbers, Addresses.


With objects, you can make the variables that store the db [database] as logical as business cards. Each person identified by a Card object which has properties for name, address and phone number.

How to Define an object:
You know that each object has certain methods and properties.

First we need to create object and then properties.

Object name is :Card

and properties are 

>>NAME
>>ADDRESS
>>MOBILE PHONE
>>HOUSE PHONE

To genrate number of objects in javascript is to create a function to make new card objects. This function is called constructor in javascript 
   
function Card(name,address,work,home){

this.name=name;
this.address=address;
this.workphone=work;
this.homephone=home;
}

Next print output like this.Let's create a function

function PrintCard()  {

line1="Name: " + this.name + "<BR>";
line2="Address:" + this.address + "<BR>";
line3="Workphone:" + this.workphone + "<BR>";
line4="Homephone:" + this.homephone +"<BR>";
document.write(line1,line2,line3,line4);
}

Above function will read the properties from current object by THIS and assign to
line1,line2,line3,line4

output with document.write(line1,line2,line3,line4)

Creating an Object Instance:

shrinivas=new Card("Vas shrinivas","new Avenue street","80987000000000","090000000" );

Now Card function is called, Assigned these parameters in to variables of Card function. And you created shrinivas object.

You did everything at a time, Above code you can write like this

1).Line-------------------------->shrinivas=new Card();
2).Line--------------------------->shrinivas.

Now if you write shrinivas. After you put (DOT after shrinivas) you will see all properties of Card function, they are name, address, work, home.

shrinivas=new Card();
shrinivas.name="Vas.Shrinivas";
shrinivas.address="new Avenue street";
shrinivas.work="80987000000000";
shrinivas.home="090000000";

Now this time to print everything

shrinivas.PrintCard();

Extending Built-in Objects

It's like extend power of objects, Means adding new features to it.

How?

For example, if u thinks the String object doesn't fit for our needs, we can extend it. 

title="Shrinivas welcomes you";

document.write(title.heading(1));

Example:
<html>
<head><title>Test of headings </title>
</head>

<body>

<script type="text/javascript">

function addhead (level) {

html="H" + level;

text=this.toString();

start="<" + html + ">";

stop="</" + html + ">";

return start + text + stop;

}

String.prototype.heading=addhead;

document.write("This is a heading 1" .heading(1));
document.write("This is a heading 2" .heading(2));
document.write("This is a heading 3" .heading(3));

</script>
</body>

</html>











Monday, 27 May 2013

About Cookies



Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com


Monday, 20 May 2013

Event handler

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com





 <html>
<title> Hear onClick event handler runs before the linked page("http://www.amcda909.com/") is loaded into the browser.

This is useful for making links conditional or displaying a 
message before launching the linked page. 
</title>
 <body>

<a href="http://www.amcda909.com/"
onClick="alert('Your are about to leave this site.');">click Here</a>


</body>

</html>

JavaScript Syntax Rules

Authour:I will teach you courses online

C Language C++ Asp.net VB.net Oracle Hardware and Networking MCSE
Contact: Name: Shrinivas Mobileno:919703619391 E-mail: vas.shrinivas002@gmail.com
Case Sensitivity

Almost everything in JavaScript is case sensitive

A). JavaScript keywords, for and if are always lowercase.

B). Builtin objects Math and Date are capital

C). DOM's are usually lowercase.

D).Blank spaces are ignored by JavaScript

Comment
// this is comment
If you want to write before writing any program like adding of two numbers. Use two forward slashes(//).

// adding of two numbers.

If you like to comment more than a single line use this

/*
This program works like calculator it
will add  numbers or multiply numbers or div numbers
and also this will works like scientific calculator
and it has much more functional ties.
*/

See above in between (/*    */) I have added more lines.




Basic Concepts of Javascript

Statement- A statement ends with semicolon, Statement is typically a single line of js, It's not a rule to break statement across multiple lines.

Examples

hours=now.getHours();
mins=now.getMinutes();
sec=now.getSeconds();


Functions:



See my previous post about Functions(Freind-add, freind-subtract):

http://javascriptwithshrinivas.blogspot.com/2013/05/about-objects.html

Functions means you assigned task, That will accomplished by functions

document.write("Wish");

Above display output to web page.


and some functions return a value

ext=prompt(" Enter some text");

Above prompt function ask you to enter some text. That text stored in ext variable.



You can also create your own functions. To avoid re coding in program, See previous post Friend-add
You can use (call) this function more times.

Objects: See my previous post
http://javascriptwithshrinivas.blogspot.com/2013/05/about-objects.html

JavaScript supports 3 kinds of objects


1).Built-in objects: JavaScript has some built in objects Like Date () ... etc. Built-in means you need not to implement anything just use it. Date () is best example.

2).DOM: Many times we used document.Write function.
In this write is method and document is object (write method belongs to document object).
We can use various components of HTML and BROWSER. Best example is alert method. It's method of window object

3). Custom objects:- Your own creation.

If else statements:


if (count==1) alert(" The countdown has reached. ");;

Above if count increases to 1 then popup box display with above message 
else not(if count==0)

Loops

for(i=1;i<=5;i++)
{
Alert("Hi. Welcome to http://javascriptwithshrinivas.blogspot.in/");

}