#include <iostream>
using std::cout, std::endl;
void printArray(short** arr, const int N){
for(int i{0}; i<N; ++i){
for(int j{0}; j < N - i; ++j){
cout << arr[i][j] << ' ';
}
cout << endl;
}
}
int main(int argc, char* argv[])
{
const int N{ 7 };
short** arr = new short*[N];
for(int i{ 0 }; i < N; ++i){
arr[i] = new short[N - i];
for(int j{0}; j < N - i; ++j){
arr[i][j] = i + 1;
}
}
printArray(arr, N);
for(int i{ 0 }; i < N; ++i){
delete[] arr[i];
}
delete[] arr;
return 0;
}
#include<iostream>
#include<clocale>
#include<iomanip>
using namespace std;
#define COLS 4
int main(int argc, char** argv)
{
setlocale(LC_ALL, "Ukrainian");
int w[][COLS] = {
{1, 3, -8, 0},
{-4, 6, 2, -5},
{3, 7, 0, 6},
{-3, 9, 11, -2}
};
cout << "Поточна матриця\n";
for (int i{0}; i < COLS; ++i)
{
for (int j{0}; j < COLS; ++j)
cout<< showpos <<w[i][j]<< setw(5);
cout << '\n';
}
cout << "\nПеретворена матриця\n";
for (int i{0}; i < COLS; ++i)
{
for (int j{0}; j < COLS; ++j)
{
if (w[i][j]>0 && w[i][j] < 6)
w[i][j] = 0;
cout<< showpos <<w[i][j]<< setw(5);
}
cout << '\n';
}
return 0;
}
for (int a = 2; a < 18; a++)
{
float t = 4 * a;
cout << "z=" << 3.5 * pow(t,2) - 7 * t + 16 << "\n";
}
{
cout << "z=" << 3.5 * pow(t,2) - 7 * t + 16 << "\n";
}
char *s = new char[yourString.size() + 1];
strcpy(s, yourString.c_str());
char *p = strtok(s, "^"); //тут указываете разделитель
while (p! = NULL) {
cout << p << endl;
p = strtok(NULL, "^");
}
delete[] s;
#include <chrono>
#include <iostream>
class Timer
{
public:
Timer()
{
start = std::chrono::high_resolution_clock::now();
}
~Timer(){
end = std::chrono::high_resolution_clock::now();
std::chrono::duration<float> duration = end - start;
std::cout << "Time : "<<duration.count()<<endl;
}
private:
std::chrono::time_point<std::chrono::high_resolution_clock> start, end;
};
int main(){
Timer t;
//весь остальной код
}