Hi.I want to know what is the problem in this program?
I can't build it for these errors in output:
2.cpp(10): error C2064: term does not evaluate to a function taking 1 arguments
2.cpp(11): error C2059: syntax error : ')'
2.cpp(13): error C2064: term does not evaluate to a function taking 1 arguments
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
//This program generetes random number.
#include <cstdlib>
#include<ctime>
#define randomize () (srand(time(0)))
#define random (25)(rand ()%25)
#include<iostream>
usingnamespace std;
int main()
{
for(int i=0;i<10;cout<<random(25)<<endl,i++);
randomize ();
cout<<"After call randomize function.\n";
for(int i=0;i<10;cout<<random(25)<<endl,i++);
return 0;
}
#include<iostream>
#include<Windows.h>
#include<cstdlib>
#include<ctime>
void randomize()
{
srand(time(0));
}
int random(int end)
{
return rand() % end;
}
void gotoxy (int,int);
usingnamespace std;
int main ()
{
randomize ();
char sg=1;
int x=11,y=31;
int x1=random(25);
int y1=random(25);
cout<<"At first";
cout.put(sg);
gotoxy (x,y);
cout<<"is here but after use random function it is there see:";
cout.put(sg);
gotoxy(x1,y1);
cout<<endl;
return 0;
}
void gotoxy (int x,int y)
{
HANDLE hConsoleOutput;
COORD dwCursorPosition;
cout.flush();
dwCursorPosition.X = x;
dwCursorPosition.Y = y;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition( hConsoleOutput,dwCursorPosition);
}
When I compile it I take only this warning:
" .cpp(7): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data"
but I can't build it yet:-(