Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
481 B
0
Indexable
Never
#include <vector>
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
	ifstream in("soundin.txt");
	int n;
	in >> n;
	vector<float> sound;
	int i;
	float a;
	for (i = 0; i < n; i++)
	{
		in >> a;
		sound.push_back(a);
	}
	float down, up;
	in >> down;
	in >> up;
	for (i = 0; i < n; i++)
	{
		if (sound[i] < down) sound[i] = down;
		if (sound[i] > up) sound[i] = up;
	}
	for (i = 0; i <n; i++)
	{
		cout << sound[i] << ' ';
	}
}