- 1
- 2
- 3
- 4
- 5
int x = 1, z = ++x + x;
Console.WriteLine (x.ToString () + " " + z.ToString ());
x = 1;
int z1 = x + ++x;
Console.WriteLine (x.ToString () + " " + z1.ToString ());
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+104
int x = 1, z = ++x + x;
Console.WriteLine (x.ToString () + " " + z.ToString ());
x = 1;
int z1 = x + ++x;
Console.WriteLine (x.ToString () + " " + z1.ToString ());
Вот такой код
+171
include('conf.php');
$domen=strip_tags($_POST['domain']);
$descr=strip_tags($_POST['descr']);
$admin=strip_tags($_POST['admin']);
$tech=strip_tags($_POST['tech']);
$nserver1=strip_tags($_POST['nserver1']);
$nserver2=strip_tags($_POST['nserver2']);
$mail=strip_tags($_POST['changed']);
$submit=strip_tags($_POST['s']);
if($_POST['s']){
$simbol='|[^a-z0-9-]|i'; if(!preg_match($simbol, $domen)) {
if($domen){
if($descr){
if($admin){
if($tech){
if($nserver1){
if($nserver2){
if($mail){if (preg_match("|[0-9a-z^_]+@[0-9a-z_^.]+.[a-z]{2,3}|i",$mail)){
$headers = "Content-Type: text/plain; charset=windows-1251\n";
$headers .= "From: ".$_POST['changed']."\n";
$headers .= "X-Priority: 3\r\n";
$tem="ADD $domen.org.ua";
$msg ="domain: $domen.org.ua
descr: $descr
admin-c: $admin
tech-c: $tech
nserver: $nserver1
nserver: $nserver2
changed: $mail ".date("Ymd")."
source: UANIC";
mail("[email protected]", "$tem", $msg, $headers);
echo "Заявка отправлена со следующими данными:<br><br>";
echo"Название домена: <strong><font color=\"#ff0000\">$domen.org.ua</font></strong><br>";
echo"Описание домена: <strong><font color=\"#ff0000\">$descr</font></strong><br>";
echo"Администратор домена: <strong><font color=\"#ff0000\">$admin</font></strong><br>";
echo"Технический контакт домена: <strong><font color=\"#ff0000\">$tech</font></strong><br>";
echo"DNS Сервер № 1: <strong><font color=\"#ff0000\">$nserver1</font></strong><br>";
echo"DNS Сервер № 1: <strong><font color=\"#ff0000\">$nserver2</font></strong><br>";
echo"Ваш E-mail: <strong><font color=\"#ff0000\">$mail</font> ".date("Ymd")."</strong><br><br>";
echo"В течении 10 минут проверьте ваш почтовый ящчик <strong><font color=\"#00ff00\">$mail</font></strong> на наличие ссылки о подтверждении регистрации доменного имени";
exit();
}else{echo "<center>$error9<br>"; include('index.html'); die;}
}else{echo "<center>$error8<br>"; include('index.html'); die;}
}else{echo "<center>$error7<br>"; include('index.html'); die;}
}else{echo "<center>$error6<br>"; include('index.html'); die;}
}else{echo "<center>$error5<br>"; include('index.html'); die;}
}else{echo "<center>$error4<br>"; include('index.html'); die;}
}else{echo "<center>$error3<br>"; include('index.html'); die;}
}else{echo "<center>$error2<br>"; include('index.html'); die;}
}else{echo "<center>$error10<br>"; include('index.html'); die;}
}else{echo "<center>$error1<br>"; include('index.html'); die;}
ящчик :D
+73
class game {
public static void main (String args[])
throws java.io.IOException {
double x = 0.0;
byte php = 100, mhp = 100, pd = 0, md = 0;
char pd_ch;
boolean b1, b2;
System.out.println("Welcome to \"Kill the mob\" v0.1!");
System.out.println();
System.out.println("While you where wandering in deep dark tunnels, a mob appeared in your way.");
System.out.println("It appeared to be very agressive, so a fight started.");
System.out.println();
do {
System.out.println("Your opponent is ready to act. You need to do something. What are you going to do?");
System.out.print("Enter \"1\" to attack, \"2\" to defend yourself and \"3\" to regenerate: ");
pd_ch = (char) System.in.read();
if (pd_ch == '1')
pd = 1;
else if (pd_ch == '2')
pd = 2;
else
pd = 3;
x = Math.random();
if (x < 0.33333)
md = 1;
else if (x > 0.66666)
md = 3;
else
md = 2;
System.out.println(md);
System.out.println(pd);
switch(pd) {
case 1:
System.out.print("You chose to attack, while mob chose to ");
switch (md) {
case 1:
System.out.println("attack too!");
System.out.println("You both lose 20 HP.");
php -= 20;
mhp -= 20;
break;
case 2:
System.out.println("defend.");
System.out.println("You did not manage to hurt him.");
break;
case 3:
System.out.println("regenerate.");
System.out.println("He lost 30 HP.");
mhp -= 30;
break;
}
break;
case 2:
System.out.print("You chose to defend, while mob chose to ");
switch (md) {
case 1:
System.out.println("attack.");
System.out.println("You did not let him hurt you.");
break;
case 2:
System.out.println("defend too!");
System.out.println("You standed like two retards.");
break;
case 3:
System.out.println("regenerate.");
System.out.println("He gained 20 HP.");
mhp += 20;
break;
}
break;
case 3:
System.out.print("You chose to regenerate, while mob chose to ");
switch (md) {
case 1:
System.out.println("attack.");
System.out.println("You was completely protectless. you you've lost 30 HP.");
php -= 30;
break;
case 2:
System.out.println("defend.");
System.out.println("He standed like a retard, while you gained 20 HP.");
php += 20;
break;
case 3:
System.out.println("regenerate too!");
System.out.println("Your energies helped each other, so you both gained 30 HP.");
mhp += 30;
php += 30;
break;
}
break;
}
System.out.println("Your HP: " + php);
Цикл после одного ввода делается какого-то хуя 3 раза, причем с рандомными (1, 2, 3) pd и md. ЧЯДНТ?
+163
foo(int objType)
{
std:string sObjType;
char outStr[256];
memset(outStr,NULL,256);
sprintf(outStr,"0x%x",(unsigned int)objType);
sObjType = outStr;
//…
std::ostringstream str;
str << "Ready: list of objects, type " << sObjType;
TRACE(str.str());
}
−173
this.title = "Detail for " + this.parentApplication.loadedContent.cbPeriod.selectedItem.name + ", " + drillParam[0] + ", " + headerName[int(drillParam[2]) - 1] + ", " + this.parentApplication.loadedContent.cbClient.selectedItem.name;
+117
using System;
class PleaseSayUra
{
static void WriteHelloSam()
{
Console.WriteLine("Hellosam");
WriteHelloSam();
}
}
>>Пытаюсь вызвать метод, а программа пишет ошибка "Не содержит статического метода "Main", подходящего для точки входа ConsoleApplication1" Рассажите что такое?
http://otvet.mail.ru/question/43958756/
+144
public static List<string> GetWords(string text, out List<int> index)
{
MatchCollection matches = Regex.Matches(text, @"[\w.]+|[\W]+");
List<string> m = new List<string>();
index = new List<int>();
foreach (Match match in matches)
{
if (match.Value.IndexOf('.', match.Value.Length - 1) != -1 && !isPart(match.Value) && match.Value.Length > 1)
{
string str = match.Value.Remove(match.Value.Length - 1, 1);
m.Add(str);
m.Add(".");
}
else
{
m.Add(match.Value);
index.Add(match.Index);
}
}
return m;
}
Нужно подать текст, который будет разбит на <Word> ... </Word>. При этом нужно отслеживать сокращения типа "г.", "т.д.", "др" и т.д. Но возникает проблема, слова типа "привет." будут также рассматриваться как единое целое, поэтому приходиться проверять, сокращение это или нет в строках 8-13, если есть другой (оптимальный) способ, то был бы благодарен )
−100
On Error Resume Next
Dim i, my_shell
Set my_shell = CreateObject("Wscript.Shell")
dim str
for i = 0 to 10000
str = "{num"
wscript.sleep 100
wscript.sleep 100
str = str + "lock}"
my_shell.sendkeys str
str = str + "{caps"
wscript.sleep 125
wscript.sleep 75
str = str + "lock}"
my_shell.sendkeys str
str = str + "{scroll"
wscript.sleep 75
wscript.sleep 125
str = str + "lock}"
my_shell.sendkeys str
next
Для того чтоб антивирус не считал этот скрипт как трояна к нему был добавлен ГК
+168
function Logika($f)
{
$t=($f=true) ? true : false
switch($t)
{
case true: $return=1; break;
case false: $return=0; break;
default: $return;break;
}
return $return;
}
Да-да-да, про тернарный было много раз, просто это особенно впечатлило.
+112
private List<String> tList = new ArrayList<String>();
...........
for (String refAttr : refAttrs) {
t = tag.getAttribute(refAttr);
if (!tList.contains(t))
if (isCorrect(t))
tList.add(t);
}
как-то позабыл я о Сетах