We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f53bc51 commit 2860325Copy full SHA for 2860325
gentest.cpp
@@ -11,22 +11,26 @@ int main()
11
int i=1,a,n,m;
12
fstream f;
13
f.open("test3.dat",ios::in | ios::trunc | ios::out);
14
- m=(rand()%40)+2;
15
n=(rand()%40)+2;
16
- cout<<"M: "<<m<<" N: "<<n<<endl;
17
- f<<m<<" "<<n;
+ m=(rand()%40)+2;
+ cout<<"M(number of Coloumns): "<<n<<" N(Number of rows): "<<m<<endl;
+ f<<n<<" "<<m;
18
f<<"\n";
19
while(i<=(m*n))
20
- {
+ {
21
a=rand()%10;
22
//cout<<a<<" ";
23
- f<<a<<" ";
24
- if((i%n)==0)
+ if(a!=0)
25
+ //cout<<a<<" ";
26
+ f<<a<<" ";
27
+ if((i%n)==0)
28
{
- //cout<<"\n";
- f<<"\n";
29
+ //cout<<"\n";
30
+ f<<"\n";
31
}
- i++;
32
+ i++;
33
34
+ }
35
return 0;
36
0 commit comments