Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Ceil Function in C++

//ceil function
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
float f= 27.86;
cout<<ceil(f);

getch();
}
Output:
28

// to find the position of a character
#include<iostream.h>
#include<conio.h>
#include<string.h>
class position
{
public:
void find_loc(char str1[])
{
char c;
int i,flag=0;
cout<<"\nEnter the character to find:";
cin>>c;
for(i=0;i<strlen(str1);i++)
{
if(str1[i] == c)
{
cout<<"\nthe position of particular charater is:"<<i;
flag=1;
}
}
if(flag == 0)
cout<<"\ncharacter not found";

}
};
void main()
{
position p;
char str[100];
cout<<"\nEnter the string:";
cin>>str;
p.find_loc(str);
getch();
}



Output:
Enter the string:calculator
Enter the character to find:u
the position of particular charater is:4