100% tevredenheidsgarantie Direct beschikbaar na je betaling Lees online óf als PDF Geen vaste maandelijkse kosten 4.2 TrustPilot
logo-home
Overig

COS assignment 2

Beoordeling
3,0
(1)
Verkocht
18
Pagina's
25
Geüpload op
06-07-2023
Geschreven in
2022/2023

COS assignment 2 solutions with source code and link to the zipped file of the solution at the end of the file change the code wisely. The link is working when not opening ask for help

Instelling
Vak










Oeps! We kunnen je document nu niet laden. Probeer het nog eens of neem contact op met support.

Geschreven voor

Instelling
Vak

Documentinformatie

Geüpload op
6 juli 2023
Aantal pagina's
25
Geschreven in
2022/2023
Type
Overig
Persoon
Onbekend

Onderwerpen

Voorbeeld van de inhoud

COS3711 2023 ASSIGNMENT 2
SOLUTION
THERE IS A LINK TO THE ZIPPED FILE AT THE END OF THIS DOCUMENT



Crystal Indigo!
Crystal Indigo!
Providing all solutions you need anytime
+27 76 626 8187




**NOTE: if the GUI is displaying differently from what you desire just change
how the widgets are displayed. copy the code and run DO necessary
changes.

,//QUESTION 1
//output




//TextCounter.h
#ifndef TEXTCOUNTER_H
#define TEXTCOUNTER_H

#include <QObject>
#include <QString>
#include <QVector>
class TextCounter : public QObject
{
Q_OBJECT
public:
explicit TextCounter(QObject *parent = nullptr);
void processArguments(int argc, char *argv[]);

private:
bool flagA;
bool flagB;
bool flagC;
bool flagD;

void countOccurrences(const QString &filename);
void printResults(int wordCount, int hyphenatedCount, int
sameCharacterCount, int nonVowelStartCount);
QString removePunctuation(const QString &text) const;
bool isWordLongerThan4CharsStartingWithCapital(const QString &word);
bool isHyphenatedWord(const QString &word);
bool isSameCharacterWord(const QString &word);
bool doesNotStartWithVowel(const QString &word);



};

#endif // TEXTCOUNTER_H



//TextCounter.cpp
#include "textcounter.h"
#include <QDebug>

, #include <QFile>
#include <QTextStream>
#include <QRegularExpression>

TextCounter::TextCounter(QObject *parent) : QObject(parent),
flagA(false), flagB(false), flagC(false), flagD(false)
{
}

void TextCounter::processArguments(int argc, char *argv[])
{
// If no arguments provided, print a message
if (argc == 1) {
qDebug() << "No arguments provided. Please include file name(s).";
return;
}

// Parse the arguments
QVector<QString> filenames;
for (int i = 1; i < argc; ++i) {
QString arg = QString::fromUtf8(argv[i]);
if (arg.startsWith('-')) {
if (arg.contains('a'))
flagA = true;
if (arg.contains('b'))
flagB = true;
if (arg.contains('c'))
flagC = true;
if (arg.contains('d'))
flagD = true;
} else {
filenames.append(arg);
}
}

// If no flags provided, assume all flags were used
if (!flagA && !flagB && !flagC && !flagD) {
flagA = true;
flagB = true;
flagC = true;
flagD = true;
}

// Process each file
for (const QString &filename : filenames) {
countOccurrences(filename);
}
}

void TextCounter::countOccurrences(const QString &filename)
{

Beoordelingen van geverifieerde kopers

Alle reviews worden weergegeven
2 jaar geleden

waste of money those codes not running and link not accessible for the zipped files

2 jaar geleden

If you did everything right your applications should run and also link should open, because the code and link have been tested by a lot of people and no complaints. If you need assistance contact on whatsapp for help

3,0

1 beoordelingen

5
0
4
0
3
1
2
0
1
0
Betrouwbare reviews op Stuvia

Alle beoordelingen zijn geschreven door echte Stuvia-gebruikers na geverifieerde aankopen.

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
CrystalIndigo University of South Africa (Unisa)
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
486
Lid sinds
5 jaar
Aantal volgers
226
Documenten
73
Laatst verkocht
1 maand geleden
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 beoordelingen

5
27
4
13
3
6
2
1
1
4

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Veelgestelde vragen