4 Replies - 786 Views - Last Post: 07 May 2011 - 06:16 PM Rate Topic: -----

#1 Student_9   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 07-May 11

I wrote a program, but I can't execute!

Posted 07 May 2011 - 05:51 PM

#include <iostream>
#include <fstream>

using namespace std;

int main ( ){
char e;
bool zgj; 
cin>>zgj;
ifstream lexo("teksti.txt");
ofstream shkruaj("kopje.txt");
lexo.seekg(0,ios::end);
int k;
k =lexo.tellg( );
k--;
while (k>=0){
lexo.seekg(k,ios::beg);
lexo.get(e);
if (zgj==0) shkruaj.put(e);
if (zgj==1) {	
if (k%2==0){
if (e!='a'|| e!='e'|| e!='u'|| e!='i'|| e!='o')shkruaj.put(e);
}else // k%2==1
shkruaj.put(e);
}
return 0;
}  


But I can't execute ???

This post has been edited by Student_9: 07 May 2011 - 05:55 PM
Reason for edit:: Added code tags


Is This A Good Question/Topic? 0
  • +

Replies To: I wrote a program, but I can't execute!

#2 no2pencil   User is online

  • Professor Snuggly Pants
  • member icon

Reputation: 6642
  • View blog
  • Posts: 30,931
  • Joined: 10-May 07

Re: I wrote a program, but I can't execute!

Posted 07 May 2011 - 05:52 PM

View PostStudent_9, on 07 May 2011 - 08:51 PM, said:

But I can execute ???

Can you describe your environment? What Operating System are you using, what compiler are you using? What happens when you try to execute it?

Just posting the code doesn't help us understand what you are seeing.
Was This Post Helpful? 0
  • +
  • -

#3 RevTorA   User is offline

  • D.I.C Regular
  • member icon

Reputation: 78
  • View blog
  • Posts: 255
  • Joined: 22-April 11

Re: I wrote a program, but I can't execute!

Posted 07 May 2011 - 05:58 PM

And please learn an indentation style, as it will help both you and anyone trying to help
Was This Post Helpful? 1
  • +
  • -

#4 #define   User is offline

  • Duke of Err
  • member icon

Reputation: 1853
  • View blog
  • Posts: 6,671
  • Joined: 19-February 09

Re: I wrote a program, but I can't execute!

Posted 07 May 2011 - 06:08 PM

This is always true.

if (e!='a'|| e!='e'|| e!='u'|| e!='i'|| e!='o') shkruaj.put(e);




If e is 'a' then e!='a' is false, and e!='e' is true.
Was This Post Helpful? 0
  • +
  • -

#5 Student_9   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 07-May 11

Re: I wrote a program, but I can't execute!

Posted 07 May 2011 - 06:16 PM

Using Windows 7, Microsoft Visual Studio 2010...
I'm sorry I have a bad English...
So I correct something in my code..
Things program need to do are :

File ‘teksti.txt’ is a text file. Program to copy a file into other file ‘kopje.txt’ in this way:
- File need to be copied from end, (from end to start)
- Be ignored vowels that are in positions couple in file ‘teksti.txt’

So when I execute, program create a file kopje.txt, but when I open it I see just (yyyyy....)
In file teksti.txt is written : file onto other file kopjee txt in this way (when i delete word "way" at the end I see just (sssss...) )
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1