DTSDev's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
New Members
Active Posts:
7 (0.01 per day)
Joined:
04-January 13
Profile Views:
1,233
Last Active:
User is offline Jan 07 2013 07:15 PM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Nintendo
Your Car:
BMW
Dream Kudos:
0
Icon   DTSDev has not set their status

Posts I've Made

  1. In Topic: C++ Programmer Roll Call!

    Posted 6 Jan 2013

    Hi! i don't know if this thread is still open. Im currently working on my own string/file stream class.
  2. In Topic: "Database" insert help

    Posted 4 Jan 2013

    ok so i did what u said and that worked, but i revised my code to have a setup, and now its not creating/writing to the files i specify
    #include <iostream>
    #include <fstream>
    #include <sys/stat.h>
    #include <sys/types.h>
    #include <string>
    #include <cstdlib>
    
    using namespace std;
    
    void addWords();
    void checkSetup();
    
    int main(int argc, char* argv[])
    {
        string input;
        
        while(true)
        {
            cout<<"Action: ";
            getline(cin, input);
            
            if(input == "add words")
                addWords();
            
            else if(input == "exit")
                exit(1);
            
            else
                cout<<"error: invalid option. type \"help\" for help"<< endl;
        }
    }
    
    void addWords()
    {
        string commonWord, elvishWord;
        char choice;
        ofstream file;
        
        checkSetup();
        
        while(true)
        {
            while(true)
            {
                cout<<"common word: ";
                getline(cin, commonWord);
                
                cout<<"So, is \""<< commonWord <<"\" correct (y/n)? ";
                cin>> choice;
                cin.ignore();
                
                if(choice == 'y')
                {
                    file.open("/Application/elfTranslator/commonWordList.txt");
                    file<< commonWord << endl;
                    file.close();
                    break;
                }
                
                else if(choice == 'n')
                    continue;
                
                else
                    cout<<"error: invalid input"<< endl;
            }
            
            while(true)
            {
                cout<<"elvish word: ";
                getline(cin, elvishWord);
                
                cout<<"So, is \""<< elvishWord <<"\" correct (y/n)? ";
                cin>> choice;
                cin.ignore();
                
                if(choice == 'y')
                {
                    file.open("/Application/elfTranslator/elfWordList.txt");
                    file<< elvishWord << endl;
                    file.close();
                    break;
                }
                
                else if(choice == 'n')
                    continue;
                
                else
                    cout<<"error: invalid input"<< endl;
            }
            
            while(true)
            {
                cout<<"Do you want to add another word (y/n)? ";
                cin>> choice;
                cin.ignore();
                
                if(choice == 'y')
                    break;
                
                else if(choice == 'n')
                    return;
                
                else
                    cout<<"error: invalid input"<< endl;
            }
        }
    }
    
    void checkSetup()
    {
        ifstream fileTest;
        ofstream fileCreate;
        int dirTest;
        mode_t mode;
        
        mode = 10;
        
        dirTest = mkdir("/Applications/elfTranslator", mode);
        
        fileTest.open("/Application/elfTranslator/elfWordList.txt");
        
        if(fileTest.fail())
        {
            fileTest.close();
            fileCreate.open("/Application/elfTranslator/elfWordList.txt");
            fileCreate.close();
        }
        
        fileTest.open("/Application/elfTranslator/commonWordList.txt");
        
        if(fileTest.fail())
        {
            fileTest.close();
            fileCreate.open("/Application/elfTranslator/commonWordList.txt");
            fileCreate.close();
        }
    }
    
    
  3. In Topic: Ruboto- JRuby on Android

    Posted 4 Jan 2013

    hi! i use it and its a great irb. i am still learning ruby so i dont know anything advanced enough to flush out a bug, but its definitly great for beginners. it also lets u save/run scripts
  4. In Topic: Introducing Myself

    Posted 4 Jan 2013

    i have a quick question about php. ive been using it to build my aunts sight and ive been using text edit. have you found any good free editors? or do u just use text edit. actually, is there an xcode plugin?

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Interests:
rubicks cube, c++, chess, linux
Years Programming:
2
Programming Languages:
c, c++, php, python, ruby, batch, shell script, obj-c, html, java, javascript, css, html

Contact Information

E-mail:
Click here to e-mail me

Friends

DTSDev hasn't added any friends yet.

Comments

DTSDev has no profile comments yet. Why not say hello?