BTC USD 83,180.0 Gold USD 4,179.06
Time now: Jun 1, 12:00 AM

Perlukan Bantuan Daripada Otai Otai Yang Hensem2

cerdit

Fun Poster
Messages
166
Joined
Mar 18, 2009
Messages
166
Reaction score
0
Points
10
ade x yg sudi membantu?

urgent...kene siapkn minggu ni gak

mcm mane nk convert output dr cout of the 1st process jadi input for the next process?

kerjasama tuan/puan/cik amat dhargai

dulu ms blaja kt u,pnah blaja c++

tu pn 1st semester

aku dpt c+

hampeh

kalaula nama program tu A++

msti aku dpt A+ gak

hehe

yang aku gune nie compile using linux fendora

coding kt bwh ni bkn c++ (aku rase la)

mungkin C

tu pn x setel lg

Quote
#include <iostream>
#include <stdio>
#include <string>
#include <fstream>
using namespace std;
int main()
{
FILE * pFile;
char mystring [100];
char tmp[100];
unsigned int x;
int numchars = 60;
int string_length;
//read from file.
pFile = fopen ("input.txt" , "r");
if (pFile == NULL) perror ("Error opening file");
else {
fgets (mystring , 100 , pFile);
puts (mystring);
fclose (pFile);
}

//Measure the length of the string.
string_length = strlen(mystring);

//Output the last characters of the string.
for(x=36;x<string_length;x++)
{
if (x<=numchars)
cout << mystring[x];
}
return 0;

}



ni plak input dia dari file input.txt

Quote
26/01/10 09:20:20 MAL BIN BIN275 TSTCB U8L5 O/CR ..N UCOS Operated


output dia yg appear kt output.txt

Quote
BIN275 TSTCB U8L5 O/CR



lpas tu, buang white spaces dr blkg (aku rase gune command last not of)

dari

Quote
"BIN275 TSTCB U8L5 O/CR "



jadi


Quote
"BIN275 TSTCB U8L5 O/CR"



pastu ambik 4 character dari blkg


Quote
O/CR


so mintak pertolongan dari sifu2 aku.. mcm mane aku leh setelkan program aku nie.....

:(

nanti aku sponsor lunch
 
cangih sunguh projek dier. haha.. apa input & output sebenarnya nih? & apa yg nak di akhir proses? mekasih
 
cangih sunguh projek dier. haha.. apa input & output sebenarnya nih? & apa yg nak di akhir proses? mekasih

bro nie input aku
26/01/10 09:20:20 MAL BIN BIN275 TSTCB U8L5 O/CR ..N UCOS Operated

aku dah wat utk extract output dari column 36 sampai column 60
dan output skang nie
BIN275 TSTCB U8L5 O/CR

so, skang nie aku nak buang space yang di belakang tue dan dapatkan empat character terakthir sebagai output akhir aku.
aku nak kuarkan


nie yang latest program aku buat..... dah jem kepala nak pikir lagi nie... di harap bleh membantu.
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
int main()
{
FILE * pFile;
char mystring [100];
int string_length;

ofstream output;

pFile = fopen ("input.txt" , "r");
output.open("output.txt", ios:: out);


fgets (mystring , 100 , pFile);
puts (mystring);

string_length = strlen(mystring);

int i=36;

while (i < 60)
{
output<<mystring;
++i;
}


fclose (pFile);
output.close();
return 0;

}


jasamu dikenang bro.... thanks for review...
 
adess x igt dah la... C++ ni result truk la..
 
nnt ku godek² balik coding ni @ tnya kawan, ku bntu kamu setakat yang boleh je la..
 
alamak..lama dah tinggal laa..kalau rajin gi google n carik forum tuk programming..tanya otai2 kt dlm forum tuu..kekadang diorang boleh tolong..
 
Back
Top
Log in Register