thoughts on my project

Hello kind souls,

I am a student studying C++, I have been tasked to
create a program that at run-time displays the size of it's source file,
list all used characters(including punctuation of course) and their occurrence
then summarize by displaying the most occurring character and least occurring
character.

In keeping with the theme of software planning I am trying to organize my
plan of attack before coding my self into a corner, as the purpose of this exercise is to indicate the way we would approach the problem.

To that end I would ask that you read and make suggestions, I hope this makes some type of sense, it is only "pseudo pseudo code".

thanks


#include <iostream>
#include <ifstream>

using namespace std;

char str[MAX SIZE OF CHARACTER TABLE HERE] = "hw1.cc";
cout << strlen(str) << endl;

std::string str1 = "hw1.cc";
<< str1.length() << endl;


int main ()
{
int firstvalue = 5, secondvalue = 15;
int * p1, * p2;

p1 = &sizeofSource; // p1 = address of sizeofSource
p2 = &mostUsed; // p2 = address of mostUsed
p3 = &leastUsed; // p3 = address of leastUsed
cout << "sizeOf is " << sizeOf << endl;
cout << "mostUsed is " << mostUsed << endl;
cout << "leastUsed is " << leastUsed << endl;
return 0;
}



//could try this a function before main like:
//sizeOf prototype

char str[MAX SIZE OF CHARACTER TABLE HERE] = "hw1.cc"; //source file
<< strlen(str) << endl;

std::string str1 = "hw1.cc";
<< str1.length() << endl;

hash source file

/*by using a pointer to original? Unsure of
effect on program to read it's source while
executing.*/

hash table to associative array //can I even do this?

/*Want to sort hash table by greatest to least
by occurrence so I can do a lookup function on
index and null -1*/


Last edited on
1.
I keeping with the them of software planning I am trying to organize my plan of attack before coding my self into a corner.
I think you're overthinking this.
This mode of thinking would make sense if you had been given a large project that could span many months. What you have here is a very simple exercise with files that should take one, two hours tops; three if you're really slow. Don't think so hard. Think one possible solution and try it. If it doesn't work, don't think you've wasted two hours. You should now be readier than two hours ago for your next try.
You're still learning, you don't have to, and probably won't, get it right the first time. Hell, even professional developers don't always get it right the first time.

2.
Unsure of effect on program to read it's source while executing.
There is no effect. The source and the program are two entirely different entities. That's like asking what's the effect of blinking in space on a cow in Moscow.

3.
hash table to associative array
WHAT? Seriously? A hash table to store character frequencies?
Occam's Razor: When you have two competing theories that make exactly the same predictions, the simpler one is the better.
Always try to think about the simplest solution. Simple is easy to implement. Simple is easy to test and debug.
Well that doesn't really help me much besides in a general moral support kind of way, and I thank you for that, but is there any particular suggestions you could make?

thanks again,
Virgil
only pseudo pseudo code


This is not pseudo code... why do so many people insist on calling small chunks of code pseudo code... sorry... it just bothers me.
@ Return 0

That's why I referred to it as "pseudo pseudo code" it wasn't a typo.
So, any suggestions?

Much obliged,

V
1.
I keeping with the them of software planning I am trying to organize my plan of attack before coding my self into a corner.
I think you're overthinking this.
This mode of thinking would make sense if you had been given a large project that could span many months. What you have here is a very simple exercise with files that should take one, two hours tops; three if you're really slow. Don't think so hard. Think one possible solution and try it. If it doesn't work, don't think you've wasted two hours. You should now be readier than two hours ago for your next try.
You're still learning, you don't have to, and probably won't, get it right the first time. Hell, even professional developers don't always get it right the first time.


You are absolutely right about my over thinking this, I am likely to over engineer things due to my lack of general knowledge and anxiousness to do it in a "smart way", clearly pretty far from that. If you could suggest an area or two to investigate, I would be very grateful.

Humbly,

V
It appears that what you posted above is simply a set of disjoint notes.

Perhaps you could start by writing some algorithms.

Firstly, from a high level, how will you compute the size of the source file?
Secondly, what data structure will you use to keep track of characters seen and frequencies?
Thirdly, how will you, from that data structure, determine the most frequent and least frequent character?

Topic archived. No new replies allowed.