-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestBench.cpp
More file actions
35 lines (32 loc) · 650 Bytes
/
testBench.cpp
File metadata and controls
35 lines (32 loc) · 650 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
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
FILE *fptr;
char c;
fptr = fopen("./input.txt", "w");
int num;
cout<<"enter total number of characters: ";
cin >> num;
while (num--)
{
int n;
char ch;
cout<<"Enter Character Frequencies: ";
cin >> n;
cout<<"Enter character: ";
cin >> ch;
if (fptr == NULL)
{
cout << "Error! opening file" << endl;
exit(1);
}
for (int i = 0; i < n; i++)
{
fprintf(fptr, "%c", ch);
}
}
fclose(fptr);
return 0;
}