signal: segmentation fault (core dumped)어디서 오류가 발생한건지 모르겠습니다...ㅠ
조회수 2277회
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int divideman(int a);
int main() {
int a, b;//입력받을 a,b
vector<int> vectorman;
vector<int> vectorman2;//자릿수 바꿔줄 백터 선언
int i = 0; int j = 0;
cout << "1~32767까지의 정수 2개를 입력해주세요\n";
cin >> a >> b;//정수 2개 입력
cout << "몫: "<<(a - a % b) / b<<"\n";
cout << "나머지: " << a % b << endl;
while (a=1) {
vectorman.at(i) = a % 10;
a=divideman(a);
i++;
}
while (b = 1) {
vectorman2.at(j) = b % 10;
b=divideman(b);
j++;
}
//reverse(vectorman.begin(),vectorman.end()); reverse(vectorman2.begin(), vectorman2.end());
i = vectorman.size()-1;
j = vectorman2.size()-1;
for (i; i==(-1); i--){
cout << vectorman.at(i) << " ";
}cout << endl;
for (j; j==(-1); j--) {
cout << vectorman2.at(j) << " ";
}cout << endl;
return 0;
}
int divideman(int a) {
return (a - a % 10)/10;
}//여기에 코드를 입력하세요
visual studio로 오류보기해도 오류는 안나오는데 컴파일하면 에러가 뜹니다 vector써서 예제풀어보려다가 도저히 오류가 왜뜨는지 모르겠어서
vector에서 발생한거같긴한데 어디서나온지를 모르겠어서 질문드립니다
댓글 입력