版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
#include<iostream>
#define MaxSize 100
#define OK 1
#define ERROR 0
//进制转换栈的操作
using namespace std;
typedef int ElemType;
typedef int Status;
typedef struct StackNode
{
ElemType data;
struct StackNode *next;
}StackNode, *LinkStack;
Status InitStack(LinkStack &S)
{
S = NULL;
return OK;
}
Status Push(LinkStack &S,Status e)/*入栈*/
{
LinkStack p;
p = new StackNode;
p->data = e;
p->next = S;
S = p;
return OK;
}
Status Change(int N, LinkStack &S)/*转换*/
{
int data;
while (N)
{
data = N % 8;
Push(S, data);
N = N / 8;
}
return OK;
}
Status Pop(LinkStack &S, int &e)/*弹出*/
{
LinkStack p;
e = S->data;
p = S;
S = S->next;
delete p;
return OK;
}
int main()
{
LinkStack S;
int N,e;/*十进制数N*/
cout << "请输入一个十进制数字N:";
cin >> N;
InitStack(S);
Change(N, S);
while (S)
{
Pop(S, e);
cout << e;
}
system("pause");
return 0;
}
msgbox "做我女朋友好吗",vbQuestion,"在吗"
msgbox ("你要的都给你")
msgbox ("带你去浪漫的土耳其")
msgbox ("全部都是你")
dim j
表白的小程序
do while j<1
Select Case msgbox("做我女朋友好吗",68,"请郑重的回答我")
Case 6 j=1
Case 7 msgbox("再给你一次机会")
end Select
loop
msgbox("我就知道你会同意的mua~")
2018年9月4日
14:58
#include <iostream>
using namespace std;
typedef struct LNode
{
int data;
struct LNode *next;
}LNode,*Linklist;
void CreatList(Linklist &L,int n)
{
int item;
Linklist p;
L = new LNode;
L->next = NULL;
for (int i = 0; i < n; i++)
{
p = new LNode;
cin >> p->data;
p->next = L->next;
L->next = p;
}
}
void PrintList(Linklist L)
{
Linklist p;
p = L->next;
while (p)
{
cout << p->data << " ";
p = p->next;
}
}
int main()
{
int n;
Linklist L;
cin >> n;
CreatList(L, n);
PrintList(L);
system("pause");
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#define LEN sizeof(struct Student)
struct Student
{
long num;
float score;
struct Student * next;
};
int n;
struct Student *creat(void)
{
struct Student *head;
struct Student *p1, *p2;
n = 0;
p1 = p2 = (struct Student *)malloc(LEN);
scanf("%ld,%f", &p1->num, &p1->score);
head = NULL;
while (p1->num != 0)
{
n = n + 1;
if (n == 1)head = p1;
else p2->next = p1;
p2 = p1;
p1 = (struct Student *)malloc(LEN);
scanf("%ld,%f", &p1->num, &p1->score);
}
p2->next = NULL;
return(head);
}
void print(struct Student *head)
{
struct Student *p;
printf("\nnow,these %d records are:\n", n);
p = head;
if (head != NULL)
do {
printf("%ld %5.1f\n", p->num, p->score);
p = p->next;
} while (p != NULL);
}
int main()
{
struct Student *head;
head = creat();
print(head);
return 0;
}
//QQ:396570755