Hjælp til c++
Jeg er ved at kode lidt c++. og når jeg starter mit script virker det fint lige indtil men svarer.Mit script ser sådan ud:
#include <iostream>
int main() {
int YN;
int y;
int n;
start:
std::cout << "Do you want me to white hej. y or n" << std::endl;
std::cin >> YN;
std::cout << "You typed" << YN << "" << std::endl;
if (YN == y) {
goto print;
} else if (YN == n) {
goto end;
} else {
std::cout << "ERROR" << std::endl;
goto start;
}
print:
system("echo hej");
goto end;
end:
system("exit");
return 0;
}
Log'en ser sådan her ud:
------ Build started: Project: shutdown, Configuration: Debug Win32 ------
Compiling...
1.cpp
c:\documents and settings\administrator\dokumenter\visual studio 2008\projects\1\1\1.cpp(15) : warning C4700: uninitialized local variable 'y' used
c:\documents and settings\administrator\dokumenter\visual studio 2008\projects\1\1\1.cpp(17) : warning C4700: uninitialized local variable 'n' used
Linking...
Embedding manifest...
Build log was saved at "c:\Documents and Settings\Administrator\Dokumenter\Visual Studio 2008\Projects\1\1\Debug\BuildLog.htm"
shutdown - 0 error(s), 2 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========