Click here to Skip to main content
14,876,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Convert string name to Control ID Name Pin
Richard MacCutchan17-May-16 22:42
mveRichard MacCutchan17-May-16 22:42 
GeneralRe: Convert string name to Control ID Name Pin
leon de boer18-May-16 19:36
Memberleon de boer18-May-16 19:36 
AnswerRe: Convert string name to Control ID Name Pin
leon de boer18-May-16 19:51
Memberleon de boer18-May-16 19:51 
AnswerRe: Convert string name to Control ID Name Pin
Gerry Schmitz19-May-16 5:54
mveGerry Schmitz19-May-16 5:54 
SuggestionRe: Convert string name to Control ID Name Pin
Krishnakumartg21-Sep-16 19:57
MemberKrishnakumartg21-Sep-16 19:57 
QuestionRPN notation in C Pin
Member 1252915917-May-16 6:19
MemberMember 1252915917-May-16 6:19 
GeneralRe: RPN notation in C Pin
harold aptroot17-May-16 6:29
Memberharold aptroot17-May-16 6:29 
GeneralRe: RPN notation in C Pin
Member 1252915917-May-16 6:57
MemberMember 1252915917-May-16 6:57 
You are right, sorry, I even forgot to put them in the code! This is something a partner gave and explained to me. There are some functions i dont even use. It's because I understand it i didn't put in here. My bad.

The full code looks like:

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <conio.h>
#define MAX 41

 int t, i, v1, v2;
 int top = -1;
 char seq[40];
 char rpn[40];
 char fin[40];
int main()
{
  printf("introduce the numbers and opreands in rpn \n");
 fgets(seq,40,stdin);

 t=strlen(seq);

 for (i=0;i<=t;i++)
 if (isdigit(seq[i]))
 {
     Push(rpn, seq[i]);
 }
 if (ispunct(seq[i]));

    v1=pop(rpn);
    v2=pop(rpn);

    if (seq[i] = '+');
        push(fin, v1+v2);
    if (seq[i] = '-');
        push(fin, v1-v2);
    if (seq[i] = '*');
        push(fin, v1*v2);
    if (seq[i] = '/');
        push(fin, v1/v2);

printf(fin);
}

int isempty() {

   if(top == -1)
      return 1;
   else
      return 0;
}

int isfull() {

   if(top == MAX)
      return 1;
   else
      return 0;
}

int peek() {
   return seq[top];
}


int pop() {
   int data;

   if(!isempty()) {
      data = seq[top];
      top = top - 1;
      return data;
   }else {
      printf("Could not retrieve data, Stack is empty.\n");
   }
}

int push(int data) {

   if(!isfull()) {
      top = top + 1;
      seq[top] = data;
   }else {
      printf("Could not insert data, Stack is full.\n");
   }
}

GeneralRe: RPN notation in C Pin
harold aptroot17-May-16 7:03
Memberharold aptroot17-May-16 7:03 
GeneralRe: RPN notation in C Pin
jeron117-May-16 7:29
Memberjeron117-May-16 7:29 
GeneralRe: RPN notation in C Pin
David Crow17-May-16 8:14
MemberDavid Crow17-May-16 8:14 
AnswerRe: RPN notation in C Pin
Richard MacCutchan17-May-16 20:50
mveRichard MacCutchan17-May-16 20:50 
QuestionPass by pointer not working Pin
Joe Smith IX15-May-16 5:52
MemberJoe Smith IX15-May-16 5:52 
AnswerRe: Pass by pointer not working Pin
Victor Nijegorodov15-May-16 10:58
MemberVictor Nijegorodov15-May-16 10:58 
GeneralRe: Pass by pointer not working Pin
Joe Smith IX17-May-16 8:34
MemberJoe Smith IX17-May-16 8:34 
AnswerRe: Pass by pointer not working [fixed] Pin
CPallini15-May-16 22:08
mveCPallini15-May-16 22:08 
GeneralRe: Pass by pointer not working Pin
Joe Smith IX17-May-16 8:25
MemberJoe Smith IX17-May-16 8:25 
GeneralRe: Pass by pointer not working Pin
CPallini17-May-16 9:58
mveCPallini17-May-16 9:58 
QuestionC string operations Pin
Member 1096409913-May-16 5:47
MemberMember 1096409913-May-16 5:47 
AnswerRe: C string operations Pin
Richard MacCutchan13-May-16 6:10
mveRichard MacCutchan13-May-16 6:10 
GeneralRe: C string operations Pin
Chris Losinger13-May-16 6:37
professionalChris Losinger13-May-16 6:37 
GeneralRe: C string operations Pin
Richard MacCutchan13-May-16 6:43
mveRichard MacCutchan13-May-16 6:43 
GeneralRe: C string operations Pin
Member 1256233616-Jun-16 12:40
MemberMember 1256233616-Jun-16 12:40 
GeneralRe: C string operations Pin
Richard MacCutchan16-Jun-16 22:10
mveRichard MacCutchan16-Jun-16 22:10 
AnswerRe: C string operations Pin
Patrice T14-May-16 3:05
mvePatrice T14-May-16 3:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.