You just type "[ code]," paste your code, and type "[ /code]," or use the <> button to the right.
As for displaying errors, it should show them at the bottom of your screen. You probably have it hidden, so try finding something along the lines of "error" or "log". For Code::Blocks, it's View|Logs or F2.
#include <iostream.h>
#include <stdlib.h>
#include <time.h>
int main (){
bool meaningless = false;
int ans,guess,times;
times=0;
srand ( time(NULL) );
ans = rand()%100 + 1;
cout << "guess a number which is ranging from 1 to 100 \n";
do{
times = times+1;
cin >> guess;
if (guess > ans)
cout <<"smaller please \n";
elseif (guess < ans)
cout <<"bigger please \n";
else {
cout << "you are right after " << times << " times of guessing \n";
meaningless=true;
}
}while (!meaningless);
return 0;
}
Like this.
I can also see the errors now. Thank you very much!