我無法找到這個問題來自哪裏,它讓我瘋狂!我的主要和一個pastebin鏈接如下。我不斷收到此錯誤:我找不出這個訪問衝突錯誤。有人能幫助我嗎?
First-chance exception at 0x0FFE108E (msvcr110d.dll) in MasterMindFSM.exe: 0xC0000005: Access violation reading location 0x2CF0D131. Unhandled exception at 0x0FFE108E (msvcr110d.dll) in MasterMindFSM.exe: 0xC0000005: Access violation reading location 0x2CF0D131.
這裏是我的主:
#pragma once
#include <iostream>
#include "Answer.hpp"
using namespace Games::MasterMind;
int main() {
Answer Line;
std::cout << Line.getAnswer(0) << std::endl;
std::cout << Line.getAnswer(1) << std::endl;
std::cout << Line.getAnswer(2) << std::endl;
std::cout << Line.getAnswer(3) << std::endl;
system("pause");
return 0;
}
這裏是伴隨主頭文件: (很抱歉,但它失去了它的格式)
您至少可以調試以找出您所擁有的功能。 – chris
@chris它不告訴我。它只是給了我錯誤。 – Tux
如果'ran = rand()%6 + 1'恰好是6,那麼你會超出範圍。 – chris