Search Results

Showing results 1 to 40 of 57
Search took 0.01 seconds.
Search: Posts Made By: AdRock
Forum: C++ 5 Days Ago
Replies: 1
Views: 151
Posted By AdRock
I've got to write a code parser but am really stuck

I have to read a file, process each token and output to a new file.

Reading and writing to files isn't a problem, it's processing each token....
Forum: C++ 5 Days Ago
Replies: 3
Views: 166
Posted By AdRock
I have some code i've written and i need to splita string and assign the results to 2 variables type and value

The first part of the string up to the : would the type and what is after the : would...
Forum: C++ 11 Days Ago
Replies: 4
Views: 204
Posted By AdRock
I think it was the way i was trying to compile it. Used to compiling on windows so used c++ file.cpp -o file.exe

should have taken the exe off in linux

I don't use linux that often but i know...
Forum: C++ 12 Days Ago
Replies: 4
Views: 204
Posted By AdRock
I got it working....don't know how
Forum: C++ 12 Days Ago
Replies: 4
Views: 204
Posted By AdRock
I don't know if this is the right board for this but here goes

I have finsihed writing my program and it compiles fine on windows using the MinGW compiler. Ihave it compiling and running fine
...
Forum: C++ 15 Days Ago
Replies: 2
Views: 216
Posted By AdRock
I don't know whay but my for loop is not working.

I did this just to test and it gives the result i expect
//for(int a=0, f=1; f < vec.size();f++, a++)
//{
rel1 = vec.at(2);
rel2 =...
Forum: C++ 15 Days Ago
Replies: 2
Views: 216
Posted By AdRock
I am trying to increment 2 variables in a for loop and i want the loop to exit when the highest value variable is reached

My example a gets the first element of a vector and f gets the next. It...
Forum: C++ 16 Days Ago
Replies: 2
Views: 244
Posted By AdRock
That is way too complicated for what i need to do as I have almost finished.

I found this example elsewhere online in a vector example and it looks similar to what i would need

for(int i=0;i <...
Forum: C++ 17 Days Ago
Replies: 2
Views: 244
Posted By AdRock
I have a 2D vector of different values. It could be text or numbers.

I need to be able to see what is in the vector and to do something depending on what is in there.

How do i access each...
Forum: C++ 18 Days Ago
Replies: 2
Views: 210
Posted By AdRock
Didn't work....i think i tried that already

I've also tried
while (p!=NULL)
{
unsigned int pos = str.find("//", 0);
if(pos != string::npos)
break;
else
vec.push_back(p);
Forum: C++ 18 Days Ago
Replies: 2
Views: 210
Posted By AdRock
I have a string which i can break down into tokens but what i want it to do is if it reaches a '//' it breaks out of the loop so no more tokens are added

I have tried using this but it doesn't...
Forum: C++ 19 Days Ago
Replies: 1
Views: 294
Posted By AdRock
I have got an example for cplusplus.com for converting a string into a char array so i can split in into tokens and adds to a vector and it works fine in the main method but if i try and create a...
Forum: C++ 25 Days Ago
Replies: 8
Views: 314
Posted By AdRock
I am struggling to come up with a solution for this as everything i have tried either gets the same output or the program crashes.

This is how i understand it

string::size_type end =...
Forum: C++ 25 Days Ago
Replies: 8
Views: 314
Posted By AdRock
Thanks

I've just solved another problem I've had for ages and that's splitting the strings of each line into tokens

This is where my current problem leads onto where i need to split each signle...
Forum: C++ 25 Days Ago
Replies: 8
Views: 314
Posted By AdRock
Yes....that is a good point are you are right. there may be an occurence where that would be needed. Every punctuation mark should be in it's own vector.

How would i rewrite that?
Forum: C++ 25 Days Ago
Replies: 8
Views: 314
Posted By AdRock
I have a string and I need to split the string into tokens

The word can contain and letter/number but can also contain punctation such as brackets

I need to be able to find an occurence of...
Forum: C++ 26 Days Ago
Replies: 2
Views: 182
Posted By AdRock
I am reading a line of text from a file and need to split it into tokens.


I need the tokens to be


How do i split a string into tokens

here is my code so far
#include <fstream>
Forum: C++ 26 Days Ago
Replies: 11
Views: 536
Posted By AdRock
I have been trying different things all day but still not getting where i need to be.

I can scan each character and output each character but it's not reading whitespace as a delimiter.

I've...
Forum: C++ 26 Days Ago
Replies: 11
Views: 536
Posted By AdRock
I need to create a list of each word and punctuation and what line they appear on like this (using your example)

See with your example I would scan the first letter and keep adding it to...
Forum: C++ 27 Days Ago
Replies: 11
Views: 536
Posted By AdRock
Many thanks

Yes I am working on a code parser and I'm getting there slowly

I've found some examples online that other people have tried for different things and i can get it working in my code...
Forum: C++ 27 Days Ago
Replies: 11
Views: 536
Posted By AdRock
I am making some progress

I'm now able to read each character from each line but the problem now is processing each character.

I still need to keep scanning each character until I reach a...
Forum: C++ 27 Days Ago
Replies: 11
Views: 536
Posted By AdRock
it should scan each character until it gets to a space so in the array would be a word. Any punctation should be in their own array element. I want to ignore whitespace and newlines

so the array...
Forum: C++ 27 Days Ago
Replies: 11
Views: 536
Posted By AdRock
I've bene banging my head against a brick wall trying to work out how to do this.

I need to be able to read a text file line by line and to read each character of the line. When the character is...
Forum: C++ Jan 26th, 2009
Replies: 9
Views: 808
Posted By AdRock
Thanks again...This has been doing my head in for ages.

In my code is there a way i can read each of the lines of the file and add whatever is between certain tags to an array?

I've been...
Forum: C++ Jan 26th, 2009
Replies: 9
Views: 808
Posted By AdRock
Many thanks.....that is what i was trying to do....i put the [] in there when i shouldn't have. I'll remember that

I was trying to output this function into a 4 x 4 matrix using tabs but it's...
Forum: C++ Jan 26th, 2009
Replies: 9
Views: 808
Posted By AdRock
Many thanks william....that's helped loads as i come to a halt. I can't beleive some of those errors were so obvious

I am trying to see if an array element contains a specific word and if it does...
Forum: C++ Jan 26th, 2009
Replies: 9
Views: 808
Posted By AdRock
I have had a go at trying to extend this program and creating a seperate class to be included which displays the lines but i've got errors. It may be simple but i can't see why.



the main...
Forum: C++ Jan 25th, 2009
Replies: 9
Views: 808
Posted By AdRock
Many thanks......exactly what i needed.

Is there a way where i could create an array for row number and an array for column numbers so i can display what row and column a certain array element is...
Forum: C++ Jan 24th, 2009
Replies: 9
Views: 808
Posted By AdRock
I am still trying to come up with a simple solution where i add lines of words to a 2d array so i can pick an array element and display what is in that array

I can read the lines of text and...
Forum: C++ Jan 21st, 2009
Replies: 16
Views: 3,368
Posted By AdRock
I have been working on this for a little while and have come up with this which isn't perfect by far
#include <fstream>
#include <iostream>
#include <string>
#include <vector>

using namespace...
Forum: C++ Jan 21st, 2009
Replies: 16
Views: 3,368
Posted By AdRock
I've come back to this cos it was doing my head in

I have to do this

I've attached the type of file i want to read

I have been thinking the last couple of days the best way to do this.I was...
Forum: C++ Jan 20th, 2009
Replies: 14
Views: 751
Posted By AdRock
Many thanks Murtan......work exactly how it should
Forum: C++ Jan 20th, 2009
Replies: 14
Views: 751
Posted By AdRock
That makes perfect sense and it seems so obvious now.

How can i call functions within the savings class withing the if statement so if the account type is savings i can call a function in that...
Forum: C++ Jan 19th, 2009
Replies: 14
Views: 751
Posted By AdRock
I've looked at type casting and have come up with this and it does compile but when i run the program and i check to see what account it is, it doesn't recognise a SavingsAccount object so the if...
Forum: C++ Jan 19th, 2009
Replies: 14
Views: 751
Posted By AdRock
Murtan to the resuce again....i would buy you a beer if i could so i'll have to give you loads of rep points.

I have it working spot on now but just another question.....

How do i go about...
Forum: C++ Jan 19th, 2009
Replies: 14
Views: 751
Posted By AdRock
I added some paramaters
//declare pointers
Account *account1 = new SavingsAccount(25.00, 1.00);
Account *account2 = new CheckingAccount(80.00, 1.00);
Account *account3 = new...
Forum: C++ Jan 19th, 2009
Replies: 14
Views: 751
Posted By AdRock
I forgot to attach my files (they're all really hpp files).....

I've now changed any functions in the classes to virtual after reading my C++ book (very simple code extracts and explanations)
...
Forum: C++ Jan 19th, 2009
Replies: 14
Views: 751
Posted By AdRock
I have an inheritance heirarchy and I need to use polymorphism.

I have some questions because i don't really understand it fully.

What i have to do is create a vector of pointers (account) to 2...
Forum: C++ Jan 18th, 2009
Replies: 26
Views: 1,082
Posted By AdRock
Don't worry, i fixed it and it works how it should very gratefull to everyone who helped :D
Forum: C++ Jan 18th, 2009
Replies: 26
Views: 1,082
Posted By AdRock
I don't think so....

I've attached all my files but it's only what you've seen already.
Showing results 1 to 40 of 57

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC