PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

New problem...

Code:

#include <stdio.h>
#include <stdlib.h>
main()
{
char name[25];

printf("What is your last name? ");
scanf(" %s", name);

if ((name[0] >= 'P') && (name[0] <= 'S'))
{
printf("You must go to room 2432 ");
printf("for your tickets.\n");
}

else
{
printf("You can get your tickets here.\n");
}
char a;
printf("Press a key to exit.\n");
scanf(" %c", &a;);
return 0;
}


This code compiles fine, but when I try to execute the program, it does not open; and no, it does not open and close right away, it does not open at all.

Am I having a compiler problem? I am using gcc.
Are you trying to compile this for the pocket pc? or is it just a genral coding question?

I just loged into my Unix account on campus and tested this out, no problems at all. Works just fine.

Oh, heres exactly what I did:
I created a text file with test.cpp, pasted your code in.

typed gcc -o test test.cpp ENTER
./test ENTER
If you're running that on a Pocket PC then it won't do anything. PPCs have no console / shell, which is what you are trying to printf to / scanf from.

Dan East
Alexander · 09 Jul 2003, 11:45 UTC — Well...
I am compiling it as a regular Windows console program. Either way, I have PocketConsole installed on my Pocket PC so that wouldn't matter.

But I do not understand why this is not working? Any ideas?
Have you tried running it from the command prompt?

Dan East
Dan East wrote:
Have you tried running it from the command prompt?

Dan East


Does not run whatsoever. Lately, I have been having these problems. Before, it would work just fine...perhaps I should get Microsoft Visual C++?
Program looks fine. What compiler are you using?
Damian, read any of the post at all before replying???

Am I having a compiler problem? I am using gcc.


Thats the compiler hes using, also we allready checked his code out.
Problem solved! I obtained a copy of Microsoft Visual C++ 6.0...all my programs work flawlessly now.

Thanks for your help and interest.
DillRye wrote:
Damian, read any of the post at all before replying???


Meh, that's a waste of time.