User Profile

Collapse

Profile Sidebar

Collapse
The Midnighter
The Midnighter
Last Activity: Feb 28 '08, 04:42 PM
Joined: Feb 24 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • The Midnighter
    started a topic Text data to an array
    in C

    Text data to an array

    I'm trying to create a maze solver here, I've got my text file loaded and it looks fine - I just need to figure out how to make it a 2D array... Here's all I have so far:

    Code:
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <vector>
    using namespace std;
    
    int main (int argc, char* argv[])
    {
        vector<string> text_file;
        string
    ...
    See more | Go to post

  • The Midnighter
    replied to 2D Array newb
    in Java
    A buddy of mine fixed the problem, had the initlization wrong >.< Was creating the array inside the loop geeez..........
    See more | Go to post

    Leave a comment:


  • The Midnighter
    replied to 2D Array newb
    in Java
    Updated code:
    [code=java]/*
    * Main.java
    *
    * Created on November 6, 2007, 12:56 PM
    *
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    */

    package airlineconsole;

    import java.io.*;

    /**
    *
    * @author Administrator
    */
    public class Main
    {
    private static...
    See more | Go to post

    Leave a comment:


  • The Midnighter
    started a topic 2D Array newb
    in Java

    2D Array newb

    Alright, so basically here's what's supposed to happen.
    It's an Airline reservation system, basically taking a row of 10 seats, 1 isle, 1 window. Yes, there's only one row. xD So 5 seats isle, 5 seats window.. Here's the code I have so far:

    Code:
    package airlineconsole;
    
    import java.io.*;
    
    public class Main
    {
        private static BufferedReader stdin = new BufferedReader(
    ...
    See more | Go to post

  • The Midnighter
    replied to Searching in a string for ints?
    in C
    :D Found a solution!
    [code=cpp]
    pos = second.find('/'); // Searches for the '/'
    d2 = second.substr(p os+1); // 1 space after '/'
    n2 = second.substr (0,pos); // from beginning to '/'
    space = second.find_fir st_of(" "); // Searches for a space


    string str(n2);
    string str2(d2);
    istringstream strin2(str2);
    istringstream strin(str);...
    See more | Go to post

    Leave a comment:


  • The Midnighter
    replied to Searching in a string for ints?
    in C
    ....
    What?

    so i is... a loop, that does what?

    Anyway, here's some code I'm working with now:

    [code=cpp]
    string str(n1);
    string str2(d1);
    istringstream strin2(str2);
    istringstream strin(str);

    strin >> c;
    strin2 >> d;
    cout << "c = " << c << "\nd = " << d...
    See more | Go to post

    Leave a comment:


  • The Midnighter
    replied to Searching in a string for ints?
    in C
    Alright.. What's [i] supposed to be? str would be my string of course.....
    See more | Go to post

    Leave a comment:


  • The Midnighter
    started a topic Searching in a string for ints?
    in C

    Searching in a string for ints?

    I'm trying to search a string for numbers, to ensure that it only contains numbers and no characters - what's the easiest way to do this?

    I thought it might be something likkkeee...
    size_t x;
    string y;

    x = y.find('0-9');
    if (x!=npos::strin g)
    {
    // if it contains anything but 0-9, exec code
    }
    else
    {
    // yeah
    }

    but, it doesn't seem to be...
    See more | Go to post

  • The Midnighter
    started a topic FractionCalc
    in C

    FractionCalc

    Alright! So this is a project that I've continued now for two or three days, and I'm pretty determined to figure this one out.

    I've been reading about constructors and classes, unfortunately I've never been able to read and comprehend very well, it would help greatly if I could have some feedback on constructors and the like.

    I am making a Fraction Calculator, which is basically going to accept two different fractions...
    See more | Go to post

  • The Midnighter
    replied to String manipulation
    in C
    Alright, so I've come to the conclusion that substr can find the variable for me after the /, but what about before the slash?

    I was thinking, if I could count how many spaces there are from the beginning of the line, until the '/' - then I could do a string::find to shove that into a variable..
    Here's my current code:
    [CODE=cpp]// Written by Michael C. Dillon
    #include <iostream>
    #include <string>...
    See more | Go to post

    Leave a comment:


  • The Midnighter
    replied to String manipulation
    in C
    ... Didn't understand your code at all mate. Also didn't compile....
    See more | Go to post

    Leave a comment:


  • The Midnighter
    replied to String manipulation
    in C
    I lied, it wasn't quite what I needed xD
    When I use that substr, its also copying the '/' into part of the variable, which is going to cause problems..
    [CODE=CPP]
    // Written by Michael C. Dillon
    #include <iostream>
    #include <string>
    #include <cstdlib>

    using namespace std;
    using std::string;

    int main ()
    {
    string first,str,str1;
    char...
    See more | Go to post

    Leave a comment:


  • The Midnighter
    replied to String manipulation
    in C
    I'd delete this if I could!
    See more | Go to post

    Leave a comment:


  • The Midnighter
    started a topic String manipulation
    in C

    String manipulation

    Alright, so I'm trying to write a fraction calculator for the hell of it, here's my problem:

    I want the user to enter in two fractions, lets say 64/100 and 55/100
    I want then to enter one fraction at a time, in exactly that format. How can I manipulate that string, so I can get the numbers separated by the '/' ?

    I've been messing around with strings for a while now, but I can't seen to figure out how to separate...
    See more | Go to post

  • The Midnighter
    started a topic Showing and Hiding forums

    Showing and Hiding forums

    I did a search for this, and couldn't find anything so I thought I'd ask you guys.

    So, I've got two forms. I'm making a notepad for my class, and I'm trying to change the colour - The way I'm trying to do this is like this.
    I've got my main form, with my Richboxeditor and I've got a button I want the user to press to change the colour, it's going to open up my second form (frmColors) and here's how I've tried it so far, it's...
    See more | Go to post
No activity results to display
Show More
Working...