Skip to content
View in the app

A better way to browse. Learn more.

Komuniti @PuTeRA

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Perlukan Bantuan Daripada Otai Otai Yang Hensem2

Featured Replies

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;

} [/quote]


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[/quote]

output dia yg appear kt output.txt

[quote]BIN275 TSTCB U8L5 O/CR [/quote]


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

dari

[quote]"BIN275 TSTCB U8L5 O/CR "[/quote]


jadi


[quote]"BIN275 TSTCB U8L5 O/CR"[/quote]


pastu ambik 4 character dari blkg


[quote]O/CR[/quote]

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

:(

nanti aku sponsor lunch

Edited by shinchai86

  • Author
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....
  • 2 weeks later...
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.org/wiki/Inter-process_communication
  • 1 month later...
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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.