-
Is This right?
Will this work? If not how can i fix it?
/* A program to input a word and draw and Chinese character
for the given word.*/
#include “GUIObj.h”
#include “Turtles.h”
#include <string.h>
void main()
{
char outString[MAX+1] = “ “,
word[10];
StringTypeIn strInputBox;
OKBox msgBox;
YesNoBox Prompt;
const int Yes = 1;
Turtle t;
t.init(260,180);
while(answer == yes) {
strcpy(word,
strInputBox.GetString(“String Input”, “Type In a Word”));
strcat(outString, word);
if (strcmp(word, “sun”) = 0) {
t.move(50); t.turn(90);
t.move(70); t.turn(90);
t.move(50); t.turn(90);
t.move(70); t.turn(180);
t.move(35); t.turn(90);
t.move(50); t.done ();
}
else if (strcmp(word, “moon”) = 0) {
t.move(50); t.turn(90);
t.move(60); t.turn(90);
t.move(50); t.turn(90);
t.move(70; t.GoToPos(260,180);
t.GoToPos(310,180);
t.GoToPos(310,150);
t.GoToPos(260,150);
penup (); t.GoToPos(310,180);
pendown (); t.GoToPos(310, 195);
t.done();
}
else if(strcmp(word, “river”) = 0) {
t.GoToPos(260,240);
penup (); t.GoToPos(275,230);
pendown (); t.GoToPos(275,190);
penup (); t.GoToPos(290,180);
pendown (); t.GoToPos(290,245);
t.done ();
}
else if(strcmp(word, “mountain”) = 0) {
t.GoToPos(260,210); t.GoToPos(300,210);
t.GoToPos(300,180); penup ();
t.GoToPos(280,165); pendown ();
t.GoToPos(280,210); t.done ();
}
}
-
> while(answer == yes) {
1. answer is undeclared
2. yes should be perhaps Yes
> strcat(outString, word);
What does this do?
> if (strcmp(word, “sun”) = 0) {
Should be
if (strcmp(word, “sun”) == 0) {
> void main()
The old favourite - main returns an int