#include "stdafx.h"
#include <cmath>
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
const int N = 7;
void Id_vector(double *vec, int zeros, int j) //зануляет первые zeros элементов, на j-е место ставит 1
{
for (int i = 0; i < zeros; i++) vec[i] = 0;
vec[j] = 1;
}
int main()
{
double *b = new double[N + 1];
for (int i = 0; i < N + 1; i++)
{
b[i] = N - i + 5;
cout << b[i] << " ";
}
cout << endl;
Id_vector(b, 4, 2);
for (int i = 0; i < N + 1; i++)
{
cout << b[i] << " ";
}
system("pause");
return 0;
}
функция изменяет сам аргумент
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.