100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Otro

COS assignment 2

Puntuación
3,0
(1)
Vendido
18
Páginas
25
Subido en
06-07-2023
Escrito en
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

Institución
Grado










Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
6 de julio de 2023
Número de páginas
25
Escrito en
2022/2023
Tipo
Otro
Personaje
Desconocido

Temas

Vista previa del contenido

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)
{
6,34 €
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Reseñas de compradores verificados

Se muestran los comentarios
2 año hace

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

2 año hace

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 reseñas

5
0
4
0
3
1
2
0
1
0
Reseñas confiables sobre Stuvia

Todas las reseñas las realizan usuarios reales de Stuvia después de compras verificadas.

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
CrystalIndigo University of South Africa (Unisa)
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
486
Miembro desde
5 año
Número de seguidores
226
Documentos
73
Última venta
2 meses hace
CrystalIndigo Solutions

providing all solutions to all computer science modules

4,1

51 reseñas

5
27
4
13
3
6
2
1
1
4

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes