need help

Page 1 of 1

1 Replies - 174 Views - Last Post: 19 September 2012 - 01:45 AM Rate Topic: -----

#1 raghvendra26  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 07-September 12

need help

Posted 19 September 2012 - 01:11 AM

#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();
	
	
}
Sir I m using Visual Studio c++

the code has output with some garvage and reverse of readen data from the atc text file and store it in the test2.text file...I want to read from atc text file some text like

Ritu

Amit

london

United

newzeeland

...and reverse of the readen data,then store it test2 text file..

please sir help me what logics are used here. if it posible then explain with the class..

thanking you sir

Is This A Good Question/Topic? 0
  • +

Replies To: need help

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1645
  • View blog
  • Posts: 3,121
  • Joined: 30-May 10

Re: need help

Posted 19 September 2012 - 01:45 AM

Stop posting the same thing every 5 minutes!
http://www.dreaminco...-from-new-line/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1