- 1
echo $(ls *.txt) | sed s/\ /,/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−2
echo $(ls *.txt) | sed s/\ /,/
А потому шо
ls *.txt | sed s/\ /,/
0
#include <iostream>
#include <vector>
#include <string>
int main()
{
int n = 6;
std::vector<int> vec;
for (int i = 0; i < n; i++)
{
if ((i % 2) == 0)
{
std::reverse(vec.begin(), vec.end());
}
vec.push_back(i);
if ((i % 2) != 0)
{
std::reverse(vec.begin(), vec.end());
}
for (int j = 0; j < vec.size(); j++)
{
std::cout << vec[j] + 1;
if (j != vec.size() - 1)
{
std::cout << "-";
}
}
std::cout << "\n";
}
}
Цель напечатать на экране следующее:
1
2-1
1-2-3
4-3-2-1
1-2-3-4-5
6-5-4-3-2-1
насколько это говнокод от 0 до 10?
0
https://pvs-studio.com/ru/blog/posts/cpp/0094/
−7
// @strict: true
interface IFace {
cond0: boolean;
cond1?: boolean;
}
function main() {
const a : IFace = { cond0: true };
print (a.cond0);
print (a.cond1 == undefined);
print (a.cond1);
// a.cond1?.value
print("done.");
}
я вам принес новую фичу. называется опциональные поля в interface-ах. а твой с++ умеет так?
+1
namespace Ifaces {
interface IFoo {
foo(): number;
}
}
class Cls1 implements Ifaces.IFoo
{
foo(): number
{
print("Hello");
return 1;
}
}
function main()
{
const cls1 = new Cls1();
cls1.foo();
const ifoo: Ifaces.IFoo = cls1;
ifoo.foo();
}
Алилуя. я вам интерфейсы принес... узрите теперь дампик
−1
function main() {
// Arrays
const trees = ["redwood", "bay", "cedar", "oak", "maple"];
print(0 in trees); // returns true
print(3 in trees); // returns true
print(6 in trees); // returns false
for (let i = 0; i in trees; i++)
{
print (trees[i]);
}
print("done.");
}
Продолжаем будни говнокодера говнокомпилятора. Сравниваем с компилятором "С".
как говориться, а ты так можешь?
0
char* to_str(int i) {
char* s = malloc(12);
sprintf(s, "%d", i);
return s;
}
Как в сишке без RAII принято жить? Пиздец какой-то. Буфер в функцию передавать?
Что мешает завезти RAII в сишку?
+3
var src = "c:\src";
var dest = "c:\dest";
var cmp = CompressionLevel.NoCompression;
var zip = source_folder + ".zip";
ZipFile.CreateFromDirectory(src, zip, cmp, includeBaseDirectory: false);
ZipFile.ExtractToDirectory(zip, dest_folder);
File.Delete(zip);
Интересный способ для копирования всех файлов в директории и поддиректориях.
https://stackoverflow.com/questions/58744/copy-the-entire-contents-of-a-directory-in-c-sharp
0
Если Ложь Тогда
Объ = Документы.ПоступлениеТоваровУслуг.СоздатьДокумент();
КонецЕсли;
Умиляет
−2
using System;
namespace c_2
{
class Program
{
static void Main(string[] args)
{
start:
Console.WriteLine("введите первое число");
var a = Convert.ToDouble(Console.ReadLine());;
Console.WriteLine("введите второе число");
var b = Convert.ToDouble(Console.ReadLine());;
Console.WriteLine("Введите действие(+ - * /)");
string act=Console.ReadLine();
if (act == "+")
{
Console.WriteLine(a+b);
}
else
{
if (act == "-")
{
Console.WriteLine(a - b);
}
else
{
if(act=="*")
{
Console.WriteLine(a*b);
}
else
{
if (act == "/")
{
Console.WriteLine(a/b);
}
}
}
Console.WriteLine("Выйти?(y/n)");
string exit = Console.ReadLine();
if (exit == "y" )
{
Environment.Exit(0);
}
else
{
if (exit == "n")
{
goto start;
}
{
}
}
}
}
}
}
Калькулятор(моя первая прога на шарпе)