ok I tried this but this does nothing. So is there any suggestions?
int main(){
Lstack S;
string s;
float a = 0;
char b = 0;
Type: Posts; User: jturner38
ok I tried this but this does nothing. So is there any suggestions?
int main(){
Lstack S;
string s;
float a = 0;
char b = 0;
What are you talking bout? All I did is post my instructions Im suppose to follow. Since I could not find the original posting I was looking for so I reposted it.
I didnt think that I couldnt find my original post so I just reposted this. What do you mean by subtract '0' from a character?
Write a program in C++ that evaluates portfix strings (one per line in a text file) with the following restrictions on the input: Each character is either an operand- if it is a digit and the...
I got it finally. Here my final code if anybody wants to check it out:
#include <iostream>
#include <string>
using namespace std;
const int DefaultListSize = 50;
typedef char Elem;
I finally got it! Here's my final code if anybody wants to see it.
#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;
const int DefaultListSize = 50;
typedef char...
The worst case would be something happens to n, n number of times!
Im suppose to give the asymptotic estimate (that is the most precise) for the number of steps as a function of n. Assum the worst case data! I know what this program does but I have no idea how to...
ok so I need to add something somewhere that converts the character into a number is that correct? Or is it something Im doin wrong with like in post #4 where Im pushing a character and not a number?
Ok well I changed it to this:
S.push(s.at(i));
But now here is whats weird. If you use subtraction the value comes out correct but if you use any other operator you wont get the right value.
So you are saying I need an if statement?
Ok when I run my program I test 23+. It suppose to be converted to 2+3 and the answer should be 5. But when I run it it gives me the answer 2. Im not sure what the problem is. Ive use the debugger...
ok I did that but I still get 0 for my answers. Here's my main program:
int main(){
Lstack S;
string s;
float a = 0;
char b = 0;
ok so could I instead assign b to any of the 5 operators then and take out my bool operator?
Eval(a, b, c);
S.push(Eval(a, b, c));
I tried this but I still get 0.
The program should convert 23+ to 2+3 and the same with 42-, it should become 4-2.
oh ok! That makes sense. Now My program runs but when I input any postfix strings I keep getting 0. Like I entered 23+ the first time and it return 0. Then I tried 42- and it return 0 as well.
Write a program in C++ that evaluates portfix strings (one per line in a text file) with the following restrictions on the input: Each character is either an operand- if it is a digit and the...
My code builds but it doesnt do anything. I think I have two things wrong with my code and Im stuck on how to fix these. I think the first one is I may not be reading my string as a char correctly...
The 4 functions are the Opener, Closer, push, and pop. Thats bc I havent put a variable in yet. But when I do it says that they are unintialized local variables. Which Im confused about.
Here is...
Here's par of my code:
bool Opener(char ch){
if((ch == '(') || (ch =='[') || (ch =='{'))
return true;
else
return false;
}/*end of opener*/
I still dont see whats wrong with that. I want to compare the top value in the stack with the front value in the Queue bc if they are the same then I should pop them then repeat. Or should I pop them...
For my project 4 I have to build a Binary Search Tree using Inorder Traversal. I know what it does but I dont know how to go about creating a code for one. This is what I got so far:
...
Write a program that uses both a Stack and a Queue to determine if a number of lines in Text File are packed palindromes or not. A packed palindrome is a sequence of characters with the property: If...
Koders Code Search: Lcd.h - C++ - GPL