#include<iostream>
using namespace std;
struct situation {
int town;
int routes[1001];
void inputRoutes();
//void deleteNew();
unsigned long int choices();
};
/*void situation::deleteNew()
{
delete[]routes;
}*/
void situation::inputRoutes()
{
for (int i = 0; i < town - 1; i++)
{
cin >> routes[i];
}
}
unsigned long int situation::choices()
{
unsigned long int total = 0;
for (int i = 0; i < town - 1; i++)
{
total *= routes[i];
if (total >= 1234567)
{
total -= 1234567;
}
}
return total;
}
int main() {
int n;
cin >> n;
situation a[1001];
for (int i = 0; i < n; i++)
{
cin >> a[i].town;
a[i].inputRoutes();
}
for (int i = 0; i < n; i++)
{
cout << a[i].choices() << endl;
}
//delete array routes
//for (int i = 0; i < n; i++)
//{
//a[i].deleteNew();
//}
//delete []a;
system("pause");
return 0;
}
mình có đoạn code thế này khi chạy trong visual studio 2017 khi run nhập vào n thì nó dừng xíu xong tắt luôn màn hình console và không báo lỗi gì hết . không biết mình bị lỗi gì mong các bạn giúp mình !
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?