Thread: program output is empty!!!

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    11

    program output is empty!!!

    program output is empty!!!
    I am not getting anything in the output.....just a blank screen. My prgram seems to have no errors when i complie and link it, but on execution it shows up nothing but a blank screen. PLEASE let me know the problem if im missing something. I'd really appreciaite ur help in this regard.....THANXXXX...~ayesha~
    here's the attachment of my program:

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    412
    Well, you're never actually reading INPUT.

    What is the goal of this code, BTW? Much of the code is "suspicious" -- copying variables that weren't initialized, your comments don't describe the code that you've written, and your for loops should need braces -- {} -- because it LOOKS like you want more than one line to loop.

    Your loops themselves look odd, as well.

    And, as mentioned, I can't tell what the code is supposed to accomplish.
    Last edited by The V.; 10-15-2001 at 09:47 PM.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    412
    BTW, here's a MUCH easier way to tell if a string is a palindrome (which it kind of looks like you might be trying to do??)

    Code:
    bool isPalindrome = true;
    for (int i = 0; i < strlen(theString);i++){
    	if (theString[i] != theString[strlen(theString) - 1 - i]) palindrome = false;
    }
    And yes, you only DO need to go to strlen(theString) / 2 + strlen(theString) %2, but it's easier to see if you just iterate over the whole string.

  4. #4
    Unregistered
    Guest
    The code is about figuring out whether each of the 5 lines in the INPUT file is a palindrome or not. I have written the command to read the input( while(!INPUT.eof()) PLease help me in this project. i'd b very thankful 2 u.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    412
    I take it you've done PERL? That while loop would work in PERL, actually.

    Your while loop here is only checking whether or not you're at the end of the file -- it's not actually reading any of the file.

    You'll need to put an INPUT.readline() into the loop somewhere. And try the method I just gave for checking a palindrome -- your code looks highly suspect in this regard.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. GPL license: how does it cover the output of a program?
    By psychopath in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 05-25-2006, 01:37 AM
  4. Redirecting program output straight to an edit control
    By bennyandthejets in forum C++ Programming
    Replies: 5
    Last Post: 07-05-2004, 08:25 AM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM