Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Web Design, HTML And CSS Forums (http://www.go4expert.com/forums/web-design-forum/)
-   -   Need some help (http://www.go4expert.com/forums/need-some-help-t2486/)

1337hendrix 9Jan2007 13:16

Need some help
 
I need to convert the following code to Javascript.

I need to convert the following code to javascript.
Code:

#include <iostream>

int main ()
{
// Variables
short first;
short second;
short previous;
short current;
short help;

// Input and communication with the user
cout << "Insert the first digit: ";
cin >> first;
cout << "\n";
cout << "Insert the second digit: ";
cin >> second;
cout << "\n";
cout << "The necklace is: ";

// Preparing for the loop
previous = second;
current = (first + second)%10;
cout >> first;
cout >> second;

// And not the WHILE loop

while ( (previous != first) || (current != second) )
{
cout >> current;
help = previous;
previous = current;
current = (help + current)%10;
}

// Writing the last digit
cout >> current;

return 0;
}

Any help would be greatly appreciated.

shabbir 9Jan2007 15:52

Re: Need some help
 
Similar to C++ to JS (converting languages)


All times are GMT +5.5. The time now is 08:05.