Coder Social home page Coder Social logo

word-counter's Introduction

Idea: Word Count

Create a simple command-line tool that takes a text file as input and outputs the number of words in the file.

Requirements:

  1. Input:

    • The tool should take a text file as a command-line argument.
  2. Processing:

    • Count the number of words in the file. Consider a word as any sequence of characters separated by whitespace.
  3. Output:

    • Display the total number of words in the file.

Example Usage:

# Using the tool in different languages
# Example in Python
python word_count.py input.txt

# Example in JavaScript (Node.js)
node word_count.js input.txt

# Example in Ruby
ruby word_count.rb input.txt

# Example in Go
go run word_count.go input.txt

# Example in C++
./word_count_cpp input.txt

Tips:

  • Keep the tool simple, focusing on the core functionality of counting words.
  • Consider handling errors, such as when the file does not exist or when there are issues reading the file.
  • Write the tool in multiple languages to compare and contrast the implementations.

This project allows you to explore file I/O, command-line argument handling, string manipulation, and basic program structure in different programming languages. It's a great way to gain familiarity with the syntax and features of various languages while working on a practical task.

word-counter's People

Contributors

tombohub avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.