I am working on a program where i have to made a word appear at centre and scroll left. I've written a program which will do the work but the problem is that my compiler (codeBlocks v16.01) is not accepting my code, i have tested the same code working on my friends computer.
// ----------------------------------------------------
// Scrolling a message.
// ----------------------------------------------------
#include <iostream>
#include <iomanip>
usingnamespace std;
#define DELAY 10000000L // Output delay
inlinevoid cls() // Clear screen
{
cout << "\033[2J\n";
}
inlinevoid locate(int z, int s) // Put cursor in row z
{ // and column s
cout << "\033[" << z << ';' << s << 'H';
}
char msg[] = "* * * B R E A K * * * ";
int main()
{
int i, start = 0, len = strlen(msg);
cls(); locate(24, 20); // Row 24, column 20
cout << "--- Press interrupt key to terminate (^C) ---";
while( true )
{
locate( 12, 25); // Row 12, column 25
i = start; // Output from index start
do
{
cout << msg[i++];
i = i % len; // if( i == len) i = 0;
}
while( i != start);
cout << endl; // Outputs buffer to screen
// Wait in short
for( int count = 0; count < DELAY; ++count)
;
++start; // For next output
start %= len; // start = start % len;
}
cls();
return 0;
}
Error compiler gives:
||=== Build: Debug in CodeBlocks (compiler: GNU GCC Compiler) ===|
C:\Users\...\Documents\CodeBlocks\main.cpp||In function 'int main()':|
C:\Users\...\Documents\CodeBlocks\main.cpp|25|error: 'strlen' was not declared in this scope|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 28 second(s)) ===|