0

I am trying to make a program that generates source code for a much larger program for simple reversal encryption. I don't know what I am doing wrong. Here is my code so far:

#include<stdio.h>
int main()
{
    FILE *fp;
fp=fopen("d:\\crypt.h", "w");

fprintf(fp, "char out[8];char cur[8];
        char con[255,255,255,255,255,255,255,255];/n
        if cur==con out==0,0,0,0,0,0,0,0;/n
        while(cur <= con) /n
            con=con-1/n

            if cur>=con out=out+1;

         ");
         return 0;
}

please help, thank you

2
Contributors
2
Replies
28
Views
3 Years
Discussion Span
Last Post by gruntler
0

Two things:

  1. String literals don't span lines. Provided there's nothing in between, you can make each line a string literal and they will be automatically concatenated onto one:

    fprintf(fp, 
        "char out[8];char cur[8];"
        "char con[255, 255, 255, 255, 255, 255, 255, 255];\n"
        "if cur == con out == 0, 0, 0, 0, 0, 0, 0, 0;\n"
        "while (cur <= con)\n"
        "    con = con - 1\n"
        "if cur >= con out = out + 1;");
    
  2. The "code" in your string is completely malformed and illegal C.

0

Thank you, I don't know what I am doing I am new to this. I thought that this would be a good way to learn to manipulate ASCII values.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.