收到一个介于 0 和 120 之间的数字

receives a number between 0 and 120

我正在尝试让程序不断询问该人的年龄,直到程序收到 0 到 120 之间的数字。我已经设置了一个 do while 循环,但我收到一条错误消息,任何帮助将不胜感激。

{
    string name = get_string("What's your name?\n");
    printf("Hello, %s\n", name);
    sleep(1);
do
{
    int age = get_int("How old are you?\n");
}
while (age < 1 || age > 120)

    printf("Wow, %s you've been around for atleast %i days!\n", name, age * 365); 
    sleep(1);

错误信息

name.c:14:8: error: use of undeclared identifier 'age'
while (age < 1 || age > 120)
       ^
name.c:14:19: error: use of undeclared identifier 'age'
while (age < 1 || age > 120)
                  ^
name.c:16:71: error: use of undeclared identifier 'age'
    printf("Wow, %s you've been around for atleast %i days!\n", name, age * 365); 
                                                                      ^
name.c:21:42: error: use of undeclared identifier 'age'
    printf("So you're %i and from %s\n", age, town);
                                         ^
4 errors generated.
<builtin>: recipe for target 'name' failed
make: *** [name] Error 1

do 之外声明 age:

int age;
do {
    age = get_int("How old are you?\n");
}
while (age < 1 || age > 120)