A
Andrei Ursan
Code:
#include <iostream.h>
#include <conio.h>
void r_string(int n, int v[])
{
int i;
for(i=0;i<n;i++)
{
cout<<"v["<<i<<"]=";
cin>>v[i];
}
}
void p_string(int n, int v[])
{
int i;
cout<<"\nThe string is : ";
for(i=0;i<n;i++)
cout<<v[i]<<" ";
}
float avarage_string(int n, int v[])
{
int i,s=0;
float av;
for(i=0;i<n;i++)
s+=v[i];
av=(float)s/n;
return av;
}
void main()
{
clrscr();
int no, a[20];
cout<<" no = ";
cin>>no;
r_string(no,a);
p_string(no,a);
cout<<"String avarage is : "<<avarage_string(no,a);
getch();
}
Strings value are read from the keyboard, and i need a getch and clrscr
method.
And how can I export the ruby code into *.exe ?
Can somebody translate this into ruby ? I need it fast...