C++ :: Extraction Between Two Barriers
May 24, 2014
I've written this code to extract everything that is between "/*" and "*/". Unfortunately it doesn't work.
#include <iostream>
#include <string>
using namespace std;
int main () {
int x = 0;
[Code] ....
View 5 Replies
Apr 7, 2014
I am currently trying to read in a file that takes in the input in the following form.
Code:
HANK>25 BOB>31 AL>54
BILL>41 ABE>63 JEFF>50
I have tried the following solution:
Code:
#include<ifstream>
#include<iostream>
using namespace std;
struct node
{
string name;
int age;
);
int main ()
{
[code]....
The problem is a.name, it's extracting the entire string before the space character causing p.age to contain "BOB" and so on. I've tried using p.get(p.name, sizeof(p.name), '-') with '-' as the delimiter and p.getline() using a character array instead of a string. How would it be possible to only copy the string into a.name before the '>' character?
View 1 Replies
View Related
Oct 1, 2013
I wrote a class that can display fractions ex. 1/4 and I cannot figure out how to get >> to process 1/4 and separate them into variables numerator and denominator.
my program just constantly creates RationalNumber Objects when it reaches cin >> A .
my overloaded stream extraction function:
istream& operator >> (istream& in, const RationalNumber& rn)
{
char L;
[Code].....
View 1 Replies
View Related
Apr 6, 2013
I want to extract expressions like <23.34 463.2 23.2 + *> in program runtime from the user. (I am trying to evaluate postfix expression)....
View 3 Replies
View Related