#include
#include
#include
#include
#include
#include
#include
#include
# pragma comment (lib, "Winmm. Lib")
# include "Todd Harper
"Void the Set ()
{
Int d;
Printf (" 1. Set up sound \ n2. Set the background music ");
The scanf (" % d ", & amp; D);
If (d==1);
{
Printf (" sound is on (Y/N) : ");
The scanf (" % c ", sc [0]. B);
}
If (d==2);
{
Printf (" the background music is on (Y/N) : ");
The scanf (" % c ", sc [1]. B);
If (sc [1]. B=='Y')
{
Puts (" 1. Happy relaxed Italy symphony ");
Puts (" 2. Romantic wedding march ");
Puts (" 3. A midsummer night's dream of slow and quiet nocturnes ");
Puts (" 4. Nervous shortness of Scotland's third symphony ");
Printf (" please select (1-4) : ");
The scanf (" % d ", & amp; Sc [1]. C);
}
}
If (d!=2 & amp; & d!
=1){
Printf (" input illegal statements ");
Set ();
}
}
Input from try2. CPP file
Void the Set ()
{
Int d;
Printf (" 1. Set up sound \ n2. Set the background music ");
The scanf (" % d ", & amp; D);
If (d==1)
{
Printf (" sound is on (Y/N) : ");
The scanf (" % c ", sc [0]. B);
}
If (d==2)
{
Printf (" the background music is on (Y/N) : ");
The scanf (" % c ", sc [1]. B);
If (sc [1]. B=='Y')
{
Puts (" 1. Happy relaxed Italy symphony ");
Puts (" 2. Romantic wedding march ");
Puts (" 3. A midsummer night's dream of slow and quiet nocturnes ");
Puts (" 4. Nervous shortness of Scotland's third symphony ");
Printf (" please select (1-4) : ");
The scanf (" % d ", & amp; Sc [1]. C);
}
}
If (d!=2 & amp; & d!
=1){
Printf (" input illegal statements ");
Set ();
}
}
In the Try1. CPP file output for
#include
#include
#include
#include
#include
#include
#include
#include
# pragma comment (lib, "Winmm. Lib")
# include "Todd Harper
"
Extern SC SC [2];
Int main ()
{
Set ();
for(int i=0; i<2; I++)
Printf (" % c, % d ", sc [I]. B, sc [I] c);
return 0;
}
header file, Todd Harper#include
#include
#include
#include
#include
#include
#include
#include
# pragma comment (lib, "Winmm. Lib")
# # ifndef a_H
# define a_H
Typedef struct set_choice
{
Char b;
int c;
} SC;//switch general structure
SC SC [2]={{' Y '}, {0}};
Void the Set ();
# endif
Error 1 & gt; C: \ users \ \ dell desktop, try, try, try1. CPP (649) : fatal error C1071: unexpected end of file encountered in the annotation
Will not after extern instead of static error but cannot run, outage and used several kinds of method doesn't work on baidu, urgent need
CodePudding user response:
Save it, since the code page to be wrong