• 0

How to count how many times a word appears in a .txt file


Question

11 answers to this question

Recommended Posts

  • 0

Why would you need a program to complete it? Surely the CTRL+F and Count would work better in Notepad++

 

Edit: or what @Nefarious Triggertrigger said :shiftyninja:

  • 0
  On 13/03/2017 at 14:04, fifikaki said:

Nefarious Trigger its a project but i have no idea what to do

Expand  

A school project? Neowin won't do your homework for you, but we can offer you guidance and point you in the right direction.

  • 0
  On 13/03/2017 at 14:12, fifikaki said:

I want to give me just an idea. Νot solve my project...maybe my question it was wrong. sorry

Expand  

I always started with pseudocode before going in to real coding. That way I had an idea of what I wanted to achieve. So let's start with that, what do you want the program to do? If you had to do the job yourself rather than creating a program, how would you count how many times a certain word appears?

  • Like 1
  • 0
  On 13/03/2017 at 14:12, fifikaki said:

 

I want to give me just an idea. Νot solve my project...maybe my question it was wrong. sorry

Expand  

So what self-driven learning have you undertaken so far?  I ask this because what you're asking is ridiculously easy, and I struggle to accept that you've even tried so far.

  • 0
  On 13/03/2017 at 13:43, anonymous_john said:

Hello! Ηow to create a program in C ++ where it counts how many times appears a specific word in a  txt file? Can someone help me?

Expand  

The problem with a question like this is we have no idea what's actually blocking you. Have you ever written any C++? Any program in any language? Do you know how to open a file in C++? Do you know how to compare strings?

 

Show us what you've done and what exactly is blocking you from making progress.

  • 0

 

  On 13/03/2017 at 14:35, winlonghorn said:

I would suggest Regular Expressions. Research MatchCollections with Regular Expressions in .NET. That should allow you to achieve what you want. Hopefully, that points you in the right direction.

Expand  

Yes regex is the solution, if you ever need to parse xml I highly suggest using regex :woot: 

But seriously, don't parse xml with regex, if you want to spend a whole summer debugging code go for it but I wouldn't recommend it, regex isn't designed to work well with nested tags neither is it made to do everything text related even when it could be done with a simpel for loop. Regex is useful as example if you don't want to search for just a word but for all words that start with neo and end with win.

 

He asked about c++ that's quite a bit different from .NET and all of it's libraries available for it.

.NET is like walking with 2 legs but c++ is not even like walking with 1 leg, it's more like having no legs at all in my experience :cry:

  • 0
  On 14/03/2017 at 05:02, Seahorsepip said:

 

Yes regex is the solution, if you ever need to parse xml I highly suggest using regex :woot: 

But seriously, don't parse xml with regex, if you want to spend a whole summer debugging code go for it but I wouldn't recommend it, regex isn't designed to work well with nested tags neither is it made to do everything text related even when it could be done with a simpel for loop. Regex is useful as example if you don't want to search for just a word but for all words that start with neo and end with win.

 

He asked about c++ that's quite a bit different from .NET and all of it's libraries available for it.

.NET is like walking with 2 legs but c++ is not even like walking with 1 leg, it's more like having no legs at all in my experience :cry:

Expand  

Sorry, I was reading in a hurry yesterday. I was trying to help out and work on a project for work at the same time. Probably wasn't the best idea. Thank you for your response! I agree about c++ btw. It can be rough! 

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • MusicPod 2.13.0 by Razvan Serea MusicPod is a super simple app that lets you play your music, listen to podcasts, and stream internet radio—all in one place. Just open it, add your music files, or search for something cool to listen to. No complicated menus, no confusing settings—just play, pause, skip, and enjoy. It supports all the usual music formats like MP3, FLAC, and M4A, and it even remembers your favorite stuff. You can also find and follow podcasts, download episodes to listen offline, and browse radio stations by name, tag, or country. It looks clean, runs fast, and is totally free. MusicPod does the job without getting in your way. MusicPod key features: Supports major audio formats like MP3, FLAC, M4A, and MP4 Organizes your local music library by title, album, or artist Built-in podcast search, subscriptions, and offline downloads Stream internet radio by name, tag, or country Pin your favorite albums, podcasts, and stations Create and manage custom playlists Smart, minimalist interface that's easy to use Stream or download media Notifications for new podcast episodes Built with Flutter for smooth, cross-platform performance MusicPod 2.13.0 changelog: bring back blur as an option, add generated l10n, fix connectivity handler (#1324) (d04834d) Translated using Weblate (Chinese (Simplified Han script)) (#1310) (20003ff) Translated using Weblate (Swedish) (#1327) (5247d62) Translations update from Hosted Weblate (#1320) (84b5c00) Translations update from Hosted Weblate (#1322) (8e1a881) Translations update from Hosted Weblate (#1325) (8027f61) Translations update from Hosted Weblate (#1328) (358ff0f) Bug Fixes missing system color icon (#1333) (7346176), closes #1302 unify ways of presenting chips in the app (#1330) (da2a8f6) Download: MusicPod 2.13.0 | 28.6 MB (Open Source) Links: MusicPod Website | MacOs | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • It's a shame an independent org have to rely on some government partner's closed technology, then they don't like something from you, you simply get locked down. 🤡
    • It looks better but needs quite a bit more GPU and CPU horsepower. Still way better performance than raytracing mode on my AMD video card.
    • Yes, because that was years ago. Waymo have been operating a safe consumer facing self-driving service for years now. They're completing 250,000 jobs a week. Interestingly in terms of behavior at junctions there have been some observed variations in self driving cars. Another, smaller company, not at the point of consumer testing yet, have observed that the cars most often tested in busy commercial centers of town are more aggressive with making turns and claiming right of way than the cars most frequently tested in suburban areas. The cars learn they have to claim the opening in traffic
    • When you let all of your systems on Microsoft, Microsoft runs your company. When it says jump, you jump, and there is nothing you can do about it.
  • Recent Achievements

    • First Post
      LsDmT earned a badge
      First Post
    • One Month Later
      evershinefacilityservice earned a badge
      One Month Later
    • Week One Done
      evershinefacilityservice earned a badge
      Week One Done
    • One Month Later
      POR2GAL4EVER earned a badge
      One Month Later
    • Week One Done
      Orpheus13 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      570
    2. 2
      ATLien_0
      256
    3. 3
      +Edouard
      163
    4. 4
      +FloatingFatMan
      157
    5. 5
      Michael Scrip
      110
  • Tell a friend

    Love Neowin? Tell a friend!