En ole varma nillä ohjelmointikielellä tuo ohjelma on kirjoitettu, veikkaisin c:tä, mutta <iostream.h> ja
� häiritsevät
/*********************************************
* Program : Horner's formula for converting
* to decimal numeric system.
*
* Date : 25 September 2001
* Author : Ilia Yordanov, Loobian
*********************************************/
//Including the libraries #1
#include <iostream.h>
#include <string.h>
//End of #1
//This is the function that makes the convertion
//It takes 3 parameters- char *array, unsigned short int system
//and int size.
//char *array is the array where is stored the number to be
//converted. Every digit of it must be in one cell
//unsigned short int system, stores which numeric system is
//the number in, and int size stores the size of the array
void horner(char *array,unsigned short int system,int size)
{
�int *result;
�result=new int[size];
�result[0]=array[0]-48;
�//Main loop that makes the convertion itself
�for(int g=0;g<size;g++)
��result[g+1]=result[g]*system + (array[g+1]-48);
�cout << "Result in decimal: "<<result[size-1]<<endl;
}
//Main function
void main()
{
�char a[100];
�unsigned short int sys;
�cout << "Enter number: ";
�cin >> a;
�int size=strlen(a); //Get the size of the array
�cout << "What numeric system is your number in? : ";
�cin >> sys;
�horner(a,sys,size);
}� on rikkinäinen merkki ja < on < merkki. Iostreamhan on c++ kirjasto. Ja siellähän on kaikki coutit sun muut...
olisi pitänyt arvata >(
No C++:aahan tuo on ihan selkeästi.
tiedän (cin,cout), oudot merkit häiritsivät liikaa, enkä lukenut koodia
Et ees vaivautunu lukemaan, mutta tulit kyllä tänne kysymään? o_O
Ei näin.
yritin kyllä kääntaä sitä, mutta mikään tulkki ei tunnistanut sitä
No ei varmaan, kun on tuollaisia outoja merkkejä ja tuo <. Olisit lukenut vain. Se on varmasti nopeampaakin kuin yrittää kääntää sitä. Ja C:tähän ei syötetä millekään tulkille vaan kääntäjälle, eli tulkki tuskin C++:aa tulkkaisi.
No ei varmaan käännä kun nuo merkit ovat sekaisin.
The dreaded websafe code of oblivion. :I
Aihe on jo aika vanha, joten et voi enää vastata siihen.