-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (35 loc) · 754 Bytes
/
Copy pathmain.cpp
File metadata and controls
39 lines (35 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// main.cpp
// GraphGen
//
// Created by Paul on 12/6/12.
// Copyright (c) 2012 Paul. All rights reserved.
//
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <time.h>
int main(int argc, const char * argv[])
{
srand( time(NULL) );
int N = atoi(argv[1]);
int M = atoi(argv[2]);
std::stringstream S;
std::fstream F;
std::string fName;
int X,Y;
S << M << "x" << M << "-" << N << ".txt";
fName = S.str();
F.open(fName,std::fstream::out);
F << N << std::endl << M << std::endl;
for (int i = 0; i < N; i++)
{
X = rand() % M;
Y = rand() % M;
F << X << " " << Y << "\n";
}
F.close();
// insert code here...
return 0;
}