Re: Informatikgedönse
Verfasst: 15.11.2010, 17:02
Nee, das nicht, aber die entwickeln das Programm, was ich beruflich verwende.
Etwas anders, und wir bereuen keinen Liter
http://forum.anstoss-zone.de/
Code: Alles auswählen
// cppTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
struct Film
{
char gerName[100];
char orgName[100];
int vjahr;
char director[100];
};
Film* filmDB[100];
Film* erzeugeFilm()
{
Film *f = new Film();
std::cout << "Director: " << std::endl;
std::cin >> f->director;
std::cout << "Jahr: " << std::endl;
std::cin >> f->vjahr;
std::cout << "Originalname: " << std::endl;
std::cin >> f->orgName;
std::cout << "deutscher Name: " << std::endl;
std::cin >> f->gerName;
return f;
}
int main(int argc, char* argv[])
{
char auswahl = 'a';
while (auswahl != 'n')
{
std::cout << "Bitte geben Sie j ein, um einen weiteren Film einzutragen." << std::endl
<< "Bitte geben Sie n ein, um das Programm zu beenden." << std::endl
<< "Bitte geben Sie d ein, um einen Film zu löschen." << std::endl
<< "Bitte geben Sie p ein, um die Daten aller gespeicherten Filme auszugeben." << std::endl;
std::cin >> auswahl;
switch(auswahl)
{
case 'j':
{
for(int i = 0; i < 100; i++)
{
if(filmDB[i] == NULL)
{
Film *f = erzeugeFilm();
filmDB[i] = f;
break;
}
}
break;
}
case 'p':
{
for(int i = 0; i < 100; i++)
{
if(filmDB[i] != NULL)
{
std::cout << "Film #" << i << " in der Filmadatenbank:"<< std::endl;
std::cout << "Deutscher Name des Films: " << filmDB[i]->gerName << std::endl;
std::cout << "Originaltitel des Films: " << filmDB[i]->orgName << std::endl;
std::cout << "Veröffentlichungsjahr des Films: " << filmDB[i]->vjahr << std::endl;
std::cout << "Regie: " << filmDB[i]->director << std::endl;
}
}
break;
}
case 'd':
{
std::cout << "Welcher Film (Index) soll gelöscht werden?" << std::endl;
int index = -1;
std::cin >> index;
if (index >= 0 && index <= 99)
{
delete filmDB[index];
filmDB[index] = NULL;
}
break;
}
}
}
delete [] *filmDB;
std::cout << "Auf Wiedersehen!";
std::cin >> auswahl;
return 0;
}
Code: Alles auswählen
#include <stdafx.h>
#include <iostream>
#include<fstream>
#include <string>
class ClToken
{
public:
std::string getTagName() { return tagName; }
std::string getAttribut1Name() { return attribut1Name; }
std::string getAttribut1Wert() { return attribut1Wert; }
std::string getAttribut2Name() { return attribut2Name; }
std::string getAttribut2Wert() { return attribut2Wert; }
void setAttribut1Name(std::string attribut1Name) {this->attribut1Name = attribut1Name;}
void setAttribut1Wert(std::string attribut1Wert) {this->attribut1Wert = attribut1Wert;}
void setAttribut2Name(std::string attribut2Name) {this->attribut2Name = attribut2Name;}
void setAttribut2Wert(std::string attribut2Wert) {this->attribut2Wert = attribut2Wert;}
void setTagName(std::string tagname) {this->tagName = tagname;}
private:
std::string tagName;
std::string attribut1Name;
std::string attribut1Wert;
std::string attribut2Name;
std::string attribut2Wert;
};
int main()
{
std::ifstream file("c:\\test.txt");
std::string buffer;
int count = 0;
while(std::getline(file, buffer))
{
count++;
ClToken *token = new ClToken();
token->setTagName(buffer.substr(1, buffer.find_first_of(' ') - 1));
buffer = buffer.substr(buffer.find_first_of(' ') + 1, buffer.length() - buffer.find_first_of(' '));
std::string attr1 = buffer.substr(0, buffer.find_first_of(' '));
token->setAttribut1Name(attr1.substr(0, attr1.find_first_of('=')));
token->setAttribut1Wert(attr1.substr(attr1.find_first_of('=')+ 1, attr1.length() - attr1.find_first_of('=')));
std::string attr2 = buffer.substr(buffer.find_first_of(' ') + 1, buffer.length() - buffer.find_first_of(' ') - 2);
token->setAttribut2Name(attr2.substr(0, attr2.find_first_of('=')));
token->setAttribut2Wert(attr2.substr(attr2.find_first_of('=')+ 1, attr2.length() - attr2.find_first_of('=')));
std::cout << "Tag " << count << std::endl;
std::cout << "Tagname: " << token->getTagName() << std::endl;
std::cout << "Attr1: " << token->getAttribut1Name() << " : " << token->getAttribut1Wert() << std::endl;
std::cout << "Attr2: " << token->getAttribut2Name() << " : " << token->getAttribut2Wert() << std::endl;
std::cout << std::endl;
}
return 0;
}
........................ liebe menschen, die immer davon ausgehen dat der andere nen vollspasti ist
Code: Alles auswählen
<?php
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."contact.php";
add_to_title($locale['global_200'].$locale['000004']);
if (isset($_POST['sendmessage'])) {
$error = "";
$mailname = substr(stripinput(trim($_POST['mailname'])), 0, 50);
$email = substr(stripinput(trim($_POST['email'])), 0, 100);
$subject = substr(str_replace(array("\r","\n","@"), "", descript(stripslash(trim($_POST['subject'])))), 0, 50);
$message = descript(stripslash(trim($_POST['message'])));
if ($mailname == "") {
$error .= " <span class='alt'>".$locale['420']."</span><br />\n";
}
if ($email == "" || !preg_match("/^[-0-9A-Z_\.]{1,50}@([-0-9A-Z_\.]+\.){1,50}([0-9A-Z]){2,4}$/i", $email)) {
$error .= " <span class='alt'>".$locale['421']."</span><br />\n";
}
if ($subject == "") {
$error .= " <span class='alt'>".$locale['422']."</span><br />\n";
}
if ($message == "") {
$error .= " <span class='alt'>".$locale['423']."</span><br />\n";
}
$_CAPTCHA_IS_VALID = false;
include INCLUDES."captchas/".$settings['captcha']."/captcha_check.php";
if ($_CAPTCHA_IS_VALID == false) {
$error .= " <span class='alt'>".$locale['424']."</span><br />\n";
}
if (!$error) {
require_once INCLUDES."sendmail_include.php";
if (!sendemail($settings['siteusername'],$settings['siteemail'],$mailname,$email,$subject,$message)) {
$error .= " <span class='alt'>".$locale['425']."</span><br />\n";
}
}
if ($error) {
opentable($locale['000004']);
echo "<div style='text-align:center'><br />\n".$locale['442']."<br /><br />\n".$error."<br />\n".$locale['443']."</div><br />\n";
closetable();
} else {
opentable($locale['000004']);
echo "<div style='text-align:center'><br />\n".$locale['440']."<br /><br />\n".$locale['441']."</div><br />\n";
closetable();
}
} else {
opentable($locale['000004']);
echo $locale['000005']."<br /><br />\n";
echo "<form name='userform' method='post' action='".FUSION_SELF."'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td width='100' class='tbl'>".$locale['000001']."</td>\n";
echo "<td class='tbl'><input type='text' name='mailname' maxlength='100' class='textbox' style='width: 200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='100' class='tbl'>".$locale['000002']."</td>\n";
echo "<td class='tbl'><input type='text' name='email' maxlength='100' class='textbox' style='width: 200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='100' class='tbl'>".$locale['000003']."</td>\n";
echo "<td class='tbl'><input type='text' name='subject' maxlength='100' class='textbox' style='width: 200px;' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='100' class='tbl'>".$locale['407']."</td>\n";
echo "<td class='tbl'>";
include INCLUDES."captchas/".$settings['captcha']."/captcha_display.php";
if (!isset($_CAPTCHA_HIDE_INPUT) || (isset($_CAPTCHA_HIDE_INPUT) && !$_CAPTCHA_HIDE_INPUT)) {
echo "</td>\n</tr>\n<tr>";
echo "<td class='tbl'><label for='captcha_code'>".$locale['408']."</label></td>\n";
echo "<td class='tbl'>";
echo "<input type='text' id='captcha_code' name='captcha_code' class='textbox' autocomplete='off' style='width:100px' />";
}
echo "</td>\n</tr>\n<tr>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='sendmessage' value='".$locale['406']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
closetable();
}
require_once THEMES."templates/footer.php";
?>
position: TW
position: TW
position: TW
position: TW
position: TW
position: TW
position: TW
position: TW
position: TW
position: TW
position: TW
Spielername_1: test
Spielername_2: test
Spielername_3: test
Spielername_4: test
Spielername_5: test
Spielername_6: test
Spielername_7: test
Spielername_8: test
Spielername_9: test
Spielername_10: test
Spielername_11:test
Sprich es soll direkt der Name hinter der Position stehen.position: TW test
position: TW test
position: TW test
position: TW test
position: TW test
position: TW test
position: TW test
position: TW test
position: TW test
position: TW test
position: TW test
Code: Alles auswählen
foreach ($_POST as $name => $wert) {
if (is_array($wert)) {
foreach ($wert as $einzelwert) {
$mailtext .= $name.$trenner.$einzelwert."\n";
}
} else {
$mailtext .= $name.$trenner.$wert."\n";
}
}
Code: Alles auswählen
<select size=1 name="position[]">
<option value="TW">TW</option>
<option value="LV">LV</option>
<option value="IV">IV</option>
<option value="RV">RV</option>
<option value="ZM">ZM</option>
<option value="ZDM">ZDM</option>
<option value="LM">LM</option>
<option value="RM">RM</option>
<option value="LOM">LOM</option>
<option value="ZOM">ZOM</option>
<option value="ROM">ROM</option>
<option value="LF">LF</option>
<option value="RF">RF</option>
<option value="MS">MS</option>
<option value="ST">ST</option>
<input type="text" name="Spielername 1" />
<br />