// file.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
class test
{
public:
char a[100],c[100];
int i,len;
void readdata(void);
void writedata(void);
void revarray(void);
};
void test::readdata()
{
cout<<" This is from file ATC\n\n";
ifstream read;
read.open("atc.text",ios::in);
read.getline(a,'\n');
len=strlen(a);
cout<<a<<"\n";
read.close();
}
void test::revarray()
{
cout<<"Reverse of info\n";
i=len-1;
do
{
c[(len-i)-1]=a[i];
cout<<a[i];
i--;
}
while(i>=0);
cout<<"\n";
}
void test::writedata()
{
cout<<"All read Info copyed in result file\n";
ofstream write;
write.open("test2.text",ios::out);
write<<c;
write.close();
}
int main()
{
test data;
data.readdata();
data.revarray();
data.writedata();
}
This post has been edited by Salem_c: 19 September 2012 - 12:02 AM
Reason for edit:: added [code][/code] tags - learn to use them yourself

New Topic/Question
Reply



MultiQuote




|