Tanya@Putera: Perlukan Bantuan Daripada Otai Otai Yang Hensem2 - Tanya@Putera

Jump to content

Selamat Hari Raya Aidilfitri dari Putera.com

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Perlukan Bantuan Daripada Otai Otai Yang Hensem2

#1 User is offline   shinchai86 Icon

  • Ahli Baru
  • Group: Learning
  • Posts: 2
  • Joined: 01-July 10

Posted 28 July 2010 - 09:12 AM

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

This post has been edited by shinchai86: 28 July 2010 - 09:13 AM

0

#2 User is offline   shinchai86 Icon

  • Ahli Baru
  • Group: Learning
  • Posts: 2
  • Joined: 01-July 10

Posted 29 July 2010 - 08:33 AM

Quote:
Originally Posted by apis17 View Post
cangih sunguh projek dier. haha.. apa input & output sebenarnya nih? & apa yg nak di akhir proses? mekasih
bro nie input aku
Quote:
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
Quote:
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
Quote:
O/CR

nie yang latest program aku buat..... dah jem kepala nak pikir lagi nie... di harap bleh membantu.
Quote:
#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];
++i;
}


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

}
jasa korang dikenang sepanjang hayat....
0

#3 User is offline   zeph Icon

  • Ahli
  • Pip
  • Group: Members
  • Posts: 42
  • Joined: 14-March 08

Posted 07 August 2010 - 12:12 PM

apsal ko suka sangat tekan enter banyak kali ni? susah betul aku nak faham soalan ko.
benda yg ko nak tu di panggil Inter process communication (IPC), banyak teknik boleh digunakan seperti file, pipe, etc. pada pendapat aku, file la paling senang nak difahami.

http://en.wikipedia....s_communication
0

#4 User is offline   otai_g Icon

  • Ahli
  • PipPipPip
  • Group: Members
  • Posts: 169
  • Joined: 31-August 04

Posted Yesterday, 04:41 PM

aku x brp paham apa yg ko nak sbnrnya.

yg aku paham ada satu fail input.txt yg contain dlm fail tu ialah "26/01/10 09:20:20 MAL BIN BIN275 TSTCB U8L5 O/CR ..N UCOS Operated".

pastu berdasarkan kod yg latest ko post tu fail output.txt yg keluar ialah "BIN275 TSTCB U8L5 O/CR".

tp bila aku compile yg keluar hanya "CB U8L5 O/CR ..N UCOS Op".

kat sini aku dah start pening.mn satu yg betul sbnrnya.

yg sbnrya ko nak keluarkan "O/CR" sahaja atau "BIN275 TSTCB U8L5 O/CR".

tlng jelaskan aku yerk...
Pentium 4 Northwood 2.4GHz
Asrock P4VM800
Infineon DDR400 2GB (2x1GB)
WD 80GB Sata + WD 80GB IDE
Nvidia MMX440 64MB
IBM T 541 (Black) 15" LCD

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic