Untitled
unknown
plain_text
3 years ago
481 B
6
Indexable
#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] << ' ';
}
}
Editor is loading...