Új hozzászólás Aktív témák
-
Mar222
csendes tag
// proba.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <cmath>using namespace std;
struct cucc{
string nev;
string ertek;
};
//----------------
string b="";
string a="";
vector<cucc>adatok;
vector<string>elotte;
//---------------------------void feldolgoz(string sor){
cucc tmp;
int db=0;
for(int i=0;i<sor.size();i++){
if(sor.at(i)!='='){
db++;
}else{
break;
}}
if(db==sor.size()){
elotte.push_back(sor);
}else{
tmp.nev=sor.substr(0,db+1);
tmp.ertek=sor.substr(db+1,sor.size());
adatok.push_back(tmp);
}
}void beker(){
ifstream fajl;
string sor;
fajl.open("server.properties");
while(getline(fajl,sor)){
feldolgoz(sor);
}
}
void eldont(){
string t="=";
cout<<"Mit akarsz atirni?: "<<endl,
cin>>b;
cout<<"Mire akarod atirni a(z) "<<b<<" -t?: "<<endl;
cin>>a;
cout<<endl;b=b+t;
for(int i=0;i<adatok.size();i++){
if(adatok.at(i).nev==b){
adatok.at(i).ertek=a;
}
}}
void kiir(){
for(int i=0;i<elotte.size();i++){
cout<<elotte.at(i)<<endl;
}
for(int i=0;i<adatok.size();i++){
cout<<adatok.at(i).nev<<adatok.at(i).ertek<<endl;
}}
void felulir(){
ofstream fajl;
fajl.open("server.properties");for(int i=0;i<elotte.size();i++){
fajl<<elotte<<endl;
}for(int i=0;i<adatok.size();i++){
fajl<<adatok.at(i).nev<<adatok.at(i).ertek<<endl;
}fajl.close();
}
int _tmain(int argc, _TCHAR* argv[])
{
beker();
kiir();
cout<<endl;
eldont();
kiir();
cout<<endl;
felulir();
system("pause");
return 0;
}igen, tisztában vagyok vele, hogy nem konvertálás, csak ez maradt meg bennem
Új hozzászólás Aktív témák
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Autós topik
- SONY LCD és LED TV-k
- Futás, futópályák
- Kormányok / autós szimulátorok topikja
- E-roller topik
- Counter-Strike: Global Offensive (CS:GO) / Counter-Strike 2 (CS2)
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Cyberpunk 2077
- Kávé kezdőknek - amatőr koffeinisták anonim klubja
- Metal topik
- További aktív témák...
- Samsung Galaxy A55 5G / 8RAM 256GB / Gyárifüggetlen / 12 Hó Garanciával
- Telefon felvásárlás!! iPhone 16/iPhone 16 Plus/iPhone 16 Pro/iPhone 16 Pro Max
- DELL Precision 5540 Workstation i7-9850H Nvidia Quadro T1000 32GB 1000GB 15.6 új akksi 1év garancia
- HIBÁTLAN iPhone 13 Pro 128GB Graphite -1 ÉV GARANCIA - Kártyafüggetlen, MS3105
- HIBÁTLAN iPhone 15 Pro Max 256GB Natura Titanium -1 ÉV GARANCIA - Kártyafüggetlen, MS3007, 91% Akksi
Állásajánlatok
Cég: FOTC
Város: Budapest