// Ex3_1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cv.h>
#include<cvcam.h>
#include <cxcore.h>
#include <highgui.h>
#include <cxtypes.h>
#pragma comment(lib,"cv.lib")
#pragma comment(lib,"cvcam.lib")
#pragma comment(lib,"cxcore.lib")
#pragma comment(lib,"highgui.lib")
void SeveralSpace(void)
{
printf("/n");
printf("/n");
}
int main(int argc, char* argv[])
{
/************ a **************/
{
double dNumber = atof(argv[1]);
printf("%f/n",dNumber);
double dAbsNumber = fabs(dNumber);
printf("%f/n",dAbsNumber);
SeveralSpace();
}
/************ b **************/
{
CvRNG nSeed = cvRNG(-1);
int nRandomNumber = 0;
for (int i = 1; i <101; i++ )
{
nRandomNumber = cvRandInt(&nSeed);
printf("%10d ",nRandomNumber);
if (0 == i % 5)
{
printf("/n");
}
}
SeveralSpace();
}
/************ c *************/
{
CvPoint2D32f fPoint = cvPoint2D32f( atof(argv[2]), atof(argv[3]) );
CvPoint nPoint = cvPointFrom32f(fPoint);
printf("X :%f Y: %f/n",fPoint.x,fPoint.y);
printf("X :%d Y: %d/n",nPoint.x,nPoint.y);
SeveralSpace();
}
/************ d *************/
{
CvPoint nPoint = cvPoint( atoi(argv[4]),atoi(argv[5]) );
printf("X :%d Y: %d/n",nPoint.x,nPoint.y);
CvPoint2D32f fPoint = cvPointTo32f(nPoint);
printf("X :%f Y: %f/n",fPoint.x,fPoint.y);
}
return 0;
}