darn... I forgot to logon...
Type: Posts; User: Unreg1stered
darn... I forgot to logon...
Can you post the whole program again? It might be easier to find the problems.
Welcome to the board... :cool:
The original version is for UNIX, but there's a ported version for Windows as well.
The reason it doesn't work when you use system("clear"); because "clear" is used in the unix shell to clear the screen. In Dos environment we use: cls.
However, how come this bored said I can't...
How about include <stdlib.h> and use system("Pause"); instead of using getch()? (assuming that your code is to run under Dos/Windows)
Guess what? I still can find some typos. :D Ex: someone instead someoen, doesn't instead of dousnt... the list keeps going on. (j/k)
while (!cin >> number1) {
}
Shouldn't it be
while (!number1) {
<iostream.h> (old version of iostream and it's recornized by old compiler)
<iostream> (new version and it's unrecornized by old compiler)
It works for you because you include the conio.o that DEV people port it to use with Dev C++.
Yes, it's a double-linked list.
http://www.bloodshed.net/dev/faq.html#conio
Dev C++, and G++ (Cygwin).
clrscr(); // works with the screen actually, I think
system ("cls"); // this just send a command to the dos shell to clear the screen
clrscr(); - // use conio.h
system ("cls"); // use stdlib.h
if (charactertype == 1)
{
gold=75;
health=100;
magic=60;
...;
}
You nee to add { and } and each item should be ended with ; instead of ,
.......
if(!data)
{
cerr << "File cannot be opened!" << endl;
system("PAUSE");
return 0; // you need to exit the program or you'll get the...
It's in stdlib.h .
Just an arays can be initialized, so alos can strings. The string can be intialized as the following exmaple:
char str[ ] = {'s', 't', 'r', 'i', 'n', 'g', '\0'}; // notice that this string is...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang98/html/_clang_l.2d.value_and_r.2d.value_expressions.asp
I'm not sure why either, I only remember that's how the c-string...
I didn't mention that in your 2nd example, you need to initialize your string this way
char nz[6]="hello"; or char nz[]="hello";
You can't just use nz[] = "hello";
Nope, that's...
Thank you. I think I found it, but it doesn't work when I try it. Do I do something wrong here?
#include <stdlib.h>
int main()
{
system ("c:\windows\notepad.exe");
return 0;
In the first program, nz is a string initialized as pointer. It's legal to assign "hello" (nameless) string to nz. Therefore your first program works perfectly.
However, in the second program, nz...
Can anyone tell me the code to call another program? Here's an example:
---
Enter selection: 1, 2, 3: 3 (when I enter 3)
the program will execute: notepad.exe ...etc.
Thanks.
Let me try to answer, and if someone find this is wrong, please correct me.
In the first example, nx is a c string. Therefore when you cout nx, you'll see the string "hello". However, in the...