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;
}
#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


Sign In
Register
Help
Selamat Hari Raya Aidilfitri dari Putera.com

MultiQuote