Its been a long time need some help

Hi all,

It has been 6 years since I have done any real programming at all, and I have lost most of my skill and lost my syntax and just plain old suck now. The only thing I have going for me is that I can get the logic part working if you guys can help me with the basic part of the program.

I am trying to make a counter that each digit in the counter can be alpha numeric. It would go from 0-9 and then from A-Z. I just want to know how to increment it in a loop and what I am doing wrong. It will probably be obvious to somebody who has some skill but this is my code... Please be gentle lol. The Error I'm getting is this its for this line
printf (c6);

and the complier is giving this error. invalid conversion from `char' to `const char*'

// basic file operations
#include <iostream>
#include <fstream>


using namespace std;




int main () {
int n = 1;
char c1=1;
char c2=2;
char c3=3;
char c4=4;
char c5=5;
char c6=6;
int temp;

while(n<=500000)
{if(c6 ==9)
c6='A';
else
if(c6 == 'Z')
c6=0;
else
c6 = ((unsigned int)c6+1);



freopen ("O:\Tony's practice\barcodes\newbarcode.txt","a",stdout);
printf (c6);
fclose (stdout);
n++;
}

return 0;
}
Last edited on
The error means that the printf() function takes as its first argument a const char *; however, you're passing a char (which is the variable C6). One fix would be:

1
2
3
4

printf( "%c", c6 );

Thank You :-)
Topic archived. No new replies allowed.