VS 不存在从 "CString" 到 "char *" 的适当转换函数

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_38991255/article/details/83306895

出现不存在从CString到const char*的转换,可以将项目属性的字符集设置从"使用Unicode字符集“转换为”使用多字字符集“,点击”项目“----"属性"----"配置属性"----”常规“----”字符集“

展开阅读全文

数据结构的疑问:不存在从 "int" 转换到 "People" 的适当构造函数?

06-26

```rn#includern#includern#define MaxWindow 30rn#define MaxProc 1rn#define error 0rnusing namespace std;rntypedef struct People ElementType;rnrnstruct Peoplernrn int T;rn int P;rn;rnrntypedef int Position;rnstruct QNode rnrn ElementType *Data;rn Position Front, Rear;rn int MaxSize;rn;rntypedef struct QNode *Queue;rnrnQueue CreatQueue(int MaxSize)rnrn Queue Q = (Queue)malloc(sizeof(struct QNode));rn Q->Data = (ElementType *)malloc(MaxSize * sizeof(ElementType));rn Q->Front = Q->Rear = 0;rn Q->MaxSize = MaxSize;rn return Q;rnrnrnbool IsFull(Queue Q)rnrn return((Q->Rear + 1) % Q->MaxSize == Q->Front);rnrnrnbool AddQ(Queue Q, ElementType X)rnrn if (IsFull(Q))rn rn printf("队列满\n");rn return false;rn rn elsern rn Q->Rear = (Q->Rear + 1) % Q->MaxSize;rn Q->Data[Q->Rear] = X;rn return true;rn rnrnrnbool IsEmpty(Queue Q)rnrn return(Q->Front == Q->Rear);rnrnrnElementType DeleteQ(Queue Q)rnrn if (IsEmpty(Q))rn rn printf("队列空\n");rn return 0;rn rnelsern rn Q->Front = (Q->Front + 1) % Q->MaxSize;rn return Q->Data[Q->Front];rn rnrnrnvoid DestroyQueue(Queue Q)rnrn free(Q);rnrnrndouble QueueingAtBank(Queue Q, int N)rnrn struct People Next;rn int k;rn int TotalTime;rn int CurrentTime;rn int Window[MaxWindow];rn int WaitTime;rn int WinAvail;rn int i, j;rn scanf("%d", &k);rnrn for (i = 0; i < k; i++)rn Window[i] = 0;rn TotalTime = 0;rnrn while (!IsEmpty)rn rn WinAvail = FindNextWindow(Window, k, &WaitTime);rn CurrentTime += WaitTime;rn Next = DeleteQ(Q);rn if (CurrentTime >= Next.T)rn TotalTime += (CurrentTime - Next.T);rn elsern rn WaitTime = Next.T - CurrentTime;rn for (j = 0; j < k; j++)rn rn Window[j] -= WaitTime;rn if (Window[j] < 0)rn Window[j] = 0;rn rn CurrentTime = Next.T;rn rn Window[WinAvail] = Next.P;rn rn return((double)TotalTime / (double)N);rnrnrnint FindNextWindow(int W[], int k, int *WaitTime)rnrn int WinAvail;rn int MinW = MaxProc + 1;rn int i;rn for (i = 0; i < k; i++)rn if (W[i] < MinW)rn rn MinW = W[i];rn WinAvail = i;rn rn *WaitTime = MinW;rn for (i = 0; i < k; i++)rn W[i] -= MinW;rn return WinAvail;rnrnrnint main()rnrn int N;rn Queue Q;rn int i;rn ElementType X;rn scanf("%d", &N);rn Q = CreatQueue(N);rn for (i = 0; i < N; i++)rn rn scanf("%d %d", &X.T, &X.P);rn AddQ(Q, X);rn rn printf("Average waiting time = %.lf minute(s).\n", QueueingAtBank(Q, N));rnrn DestroyQueue(Q);rn return 0;rnrn```rn 1 IntelliSense: 不存在从 "int" 转换到 "People" 的适当构造函数rn请问各位大佬我这串代码的报错是为什么呀 问答

没有更多推荐了,返回首页