+ Reply to Thread
Results 1 to 6 of 6

Thread: Tutorial an easy ghostwritter

  1. #1
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,852
    Blog Entries
    4
    Rep Power
    49

    Tutorial an easy ghostwritter

    Hey again, I thought I will give a small tutorial how to make a ghostwritter. I have made this with some help of CC, so it turned out to be awsome.
    So lets go on.

    First lets build the input reader.
    Code:
    import java.util.*;//Using the scanner, instead of Keyboard reader
    public class ghostwritter {
    
    	protected static Scanner sc = new Scanner(System.in);//Setting up scanner
    	
    	public static void main(String[] arg) throws InterruptedException {
    		
    		System.out.println("Type in something ");//The input reader
    Now we would want to use the input data, so...
    Code:
    String x = sc.nextLine();//This will allow the input data to be used(Note input was a string and will be used as a string)
    Now on to the function, we want it to type out letter by letter with a delay. What I call a "ghostwritter"
    Code:
    for(int i=0; i<x.length(); i++) {//A loop thru the entire string
    			System.out.print(x.charAt(i));//Catching very "x" one by one
    			Thread.sleep(1000);//Put every "x" out it with one second delay(1000ms = 1 s)
    		}
    	}	
    }
    So here is the whole code
    Code:
    import java.util.*;
    public class ghostwritter {
    
    	protected static Scanner sc = new Scanner(System.in);
    	
    	public static void main(String[] arg) throws InterruptedException {
    		
    		System.out.println("Type in something ");
    		
    			String x = sc.nextLine();
    
    		for(int i=0; i<x.length(); i++) {
    			System.out.print(x.charAt(i));
    			Thread.sleep(1000);
    		}
    	}	
    }
    Hope it will be useful, and again sorry for my weak explaination...

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: Tutorial an easy ghostwritter

    I saw your code, was bored, and thought I'd show people how to do it in C++.
    Here it is....

    Code:
    /* "Ghost Writer" In C++ */
    
    #include <iostream>
    #include <windows.h>
    #include <conio.h>
    
    using namespace std;
    
    int main() {
        char the_phrase[10000];
        int i;
        cout << "Enter a phrase you want to see outputted by the Ghost Writer: ";
        cin.get(the_phrase, 10000);
        cout << "\n\n";
        for (i = 0; i < strlen(the_phrase); i++) {
            cout << the_phrase[i];
            Sleep(100);
        }
        getch();
        return 0;
    }

  4. #3
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,852
    Blog Entries
    4
    Rep Power
    49

    Re: Tutorial an easy ghostwritter

    Quote Originally Posted by MeTh0Dz View Post
    I saw your code, was bored, and thought I'd show people how to do it in C++.
    Here it is....

    Code:
    /* "Ghost Writer" In C++ */
    
    #include <iostream>
    #include <windows.h>
    #include <conio.h>
    
    using namespace std;
    
    int main() {
        char the_phrase[10000];
        int i;
        cout << "Enter a phrase you want to see outputted by the Ghost Writer: ";
        cin.get(the_phrase, 10000);
        cout << "\n\n";
        for (i = 0; i < strlen(the_phrase); i++) {
            cout << the_phrase[i];
            Sleep(100);
        }
        getch();
        return 0;
    }
    Lol sweet but isn't out of topic ?(This is the Java section xD)

  5. #4
    Join Date
    May 2008
    Posts
    2,126
    Blog Entries
    1
    Rep Power
    33

    Re: Tutorial an easy ghostwritter

    Lol well I didn't want to start my own topic and write a full tutorial and all, so I figured this was the best place for it.

  6. #5
    Jordan Guest

    Re: Tutorial an easy ghostwritter

    Nice tutorial/code Turk4n, +rep.

  7. #6
    Join Date
    May 2008
    Location
    Hell
    Posts
    3,852
    Blog Entries
    4
    Rep Power
    49

    Re: Tutorial an easy ghostwritter

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. C# Begginer Tutorial -Easy to Learn
    By Davide in forum CSharp Tutorials
    Replies: 12
    Last Post: 01-30-2012, 07:30 AM
  2. Easy One
    By yourmom615 in forum Java Help
    Replies: 6
    Last Post: 03-12-2011, 09:39 AM
  3. [help]400$, the easy way.
    By AdvMutant in forum The Lounge
    Replies: 4
    Last Post: 11-29-2010, 11:01 AM
  4. should be easy, but please look
    By romanbodenmiller in forum C and C++
    Replies: 2
    Last Post: 12-11-2008, 06:46 PM
  5. Should be a easy fix.. Help please
    By Whitey in forum PHP Development
    Replies: 4
    Last Post: 03-25-2008, 10:35 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts