×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can anyone help to code this program?

Can anyone help to code this program?

Can anyone help to code this program?

(OP)
should display the following ;
x   x    xxx
xx  x   x   x
x x x  x     x
x  xx   x   x
x   x    xxx

from this file

100010000111Y
1100100010001Z
10101001000001Y
1001100010001Z
100010000111Z
E

/* CH8A.C */
/* Interprets lines of A's and B's */
#include <stdio.h>
main ()
{
/* Description  ......
   Open input file
   Read first character
   WHILE not at end of file
      WHILE not at end of line
         IF character = A
            Display X
       ELSE
          Display a space
       Read next character
      Read past newline and read 1st character on next line
      Move to next line in output
   Close input file
*/

/* variable declarations */


char current_character;


FILE *ch8a01 = fopen ("ch8a01.dat", "r");

fscanf (ch8a01, "%d", ¤t_character);

while (current_character != "E");
   while ((current_character != "Y") || (current_character != "Z"));
      {
      if (current_character = "A");
      printf ("X");
      else (current_character = " ");
      printf (" ");
      }
    fscanf (ch8a01, "%d", ¤t_character);


fclose (ch8a01);



getch ();

}
 

Can you plaese help me get the right coding

RE: Can anyone help to code this program?

well it looks like you got an infinte loop with yoru while, and you are looking for "A" when you should be looking for "1"

Matt

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close