在学习编写带声音的Helloworld程序时书里提到需要编译链接,请问在哪里编译链接呢,DOS窗口吗,为啥不行呢
请各位大神教教
gcc是一种编译工具,可以先下载安装到windows系统,因为你没有安装gcc所有不行!
直接百度搜索gcc windows版本就可以了!
#include <bits/stdc++.h>
using namespace std;
int main()
{
int data[101], next[101];
int n;
scanf("%d", &n);
for(int i = 1; i <= n; i++)
scanf("%d", &data[i]);
int len = n;
for(int i = 1; i <= n; i++)
{
if(i!=n)
next[i] = i+1;
else
next[i] = 0;
}
len++;
scanf("%d", &data[len]);
int t = 1;
while(t != 0)
{
if(data[next[t]] > data[len])
{
next[len] = next[t];
next[t] = len;
break;
}
t = next[t];
}
t = 1;
while(t != 0)
{
printf("%d ", data[t]);
t = next[t];
}
return 0;
}
使用模拟链表也可以实现双向链表和循环链表