Impressive-looking c++ problem anyone?

I have been wanting to do some extra credit for my C++ beginners class.
We have done basic things with classes, and numerous variations on functions, fstream, arrays, etc.

The normal one-year course.

I don't want any impressive-looking code to turn in, that obviously wouldn't be right. I just want to know if you have any exercises that look good or nice, and would be possible to do at my level. I am very proficient in my class, and should be able to handle most things thrown at me that I have the capacity to know how to do.

Thanks in advance.
Sorting functions always look impressive, Anything where you are processing data from an external file then copying it to another while counting the words or letters or something.
Write a program that takes two arguments at the command line, both strings. The program checks to see whether or not the second string is a substring of the first (without using the substr -- or any other library -- function). One caveat: any * in the second string can match zero or more characters in the first string, so if the input were abcd and the substring were a*c, then it would count as a substring. Also, include functionality to allow an asterisk to be taken literally if preceded by a \, and a \ is taken literally except when preceding an asterisk.
This is brutal for a novice, if you can do this and you don't get extra credit from your teacher then they're crazy or they think you cheated but they can't prove it.

Better yet, have the application take the arguments before it executes BUT if no arguments or not enough arguements are passed then it should prompt the user to enter the data when it executes. For example:

Program executes if it is called as

program.exe argument1 argument2
executes without prompting the user

or

program.exe argument1
prompts the user for argument2
then executes

or

program.exe
then prompts the user for both argument 1&2
then executes

Great idea blackcoder41!

Last edited on
I remember the time when I was coding this I don't have internet connection, I can do more work. Now that I'm connected to the internet, I'm lazy to code. lol

[edit]

PS: I think he can do this because he already attended 1 year course. I started to code this the second week I learned "hello world" and it took me about 5 days to finish : )
Last edited on
An assignment I really enjoyed for an algorithms course went like this:
Given an array A of pairs (u,v), and a number S, find whether a subset of A choosing either A[i].u, A[i].v, or neither, that sums to S exists.


A simple algorithm would be exponentially recursive (like the Fibonacci functions).

A smarter one would work much faster. I got results for over 100 element (pair) arrays in under a second using an interpreted language.

This is a moderately difficult problem for a beginner.
Topic archived. No new replies allowed.