weiler atherton polygon clipping source code in c code example
Example 1: tellg and seekg c++
#include <iostream>
#include <fstream>
int main () {
std::ifstream is ("test.txt", std::ifstream::binary);
if (is) {
is.seekg (0, is.end);
int length = is.tellg();
is.seekg (0, is.beg);
char * buffer = new char [length];
is.read (buffer,length);
is.close();
std::cout.write (buffer,length);
delete[] buffer;
}
return 0;
}
Example 2: floor() in c++
floor(x):This function in C++ returns the smallest possible integer value which is smaller
than or equal to the given argument.
Input : 2.5 ,-2.1 ,2.9
Output : 2 ,-3, 2
Example 3: fail() in c++
#include <iostream>
using namespace std;
int main()
{
int number;
do{
cin >> number;
if(cin.fail())
cout << "Not a number " << endl;
}while(!cin.fail());
cout << "number is " << number << endl;
system("pause");
return 0;
}