Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-24-2005, 01:39 PM   #1 (permalink)
slashdot
Registered User
 
Join Date: Dec 2004
Posts: 43
slashdot is on a distinguished road
Will someone give some simple c++ tests?

I'm not good with making programs up, though I should, I'll have to work on that later. But can someone make up a couple simple programs that I must figure out how to code? Don't write the code but let me figure out how to make it. Thanx .
slashdot is offline   Reply With Quote
Old 06-24-2005, 11:40 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Make me a simple bubblesort program. Then implement it in such a way so the client programmer can choose whether he wants to sort by ascending order or sort by descending order.

- Forward the results to standard iostream.
- Initialize a std::string array.
- Let the sorter sort arrays.
- Don't implement anything that has nothing to do with this assignment. No menu's etc.
- Use descriptive names.
- Implement app in your namespace, e.g.
Code:
namespace slashdot
{
}
__________________
Valmont is offline   Reply With Quote
Old 06-27-2005, 04:17 PM   #3 (permalink)
Rashakil Fol
Registered User
 
Join Date: Jun 2005
Posts: 3
Rashakil Fol is on a distinguished road
Reverse Polish Notation is a way of writing mathematical notation in which the operators go after the arguments, which does not require parentheses. For example, 3 5 + simplifies to 8, and 4 7 * simplifies to 28. If you write 1 2 3 + +, first the 2 3 + simplifies to 5, then 1 5 + simplifies to 6. The quadratic formula, normally written (-b + sqrt(b*b - 4*a*c)) / (2 * a), would be written as

b b * a c * 4 * - sqrt b - 2 a * /

RPN calculators use a stack to evaluate their expressions, and a basic four-function RPN calculator can be written in one line of Perl. Write one in C++. Search on the Web for more information.

I first read this recommendation in a response to an Ask Slashdot question, by the way :-)
Rashakil Fol is offline   Reply With Quote
Old 06-27-2005, 10:06 PM   #4 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
No, I gave slashdot this task for a good reason. It is *exactly* the same task I give profesional junior coders. From there we'll build up something. The whole purpose is to see what design is all about. My assignment is the first step out of a few.
__________________
Valmont is offline   Reply With Quote
Old 07-10-2005, 12:48 PM   #5 (permalink)
slashdot
Registered User
 
Join Date: Dec 2004
Posts: 43
slashdot is on a distinguished road
thats too advance for me. Maybe a simple game or something would do better. But if you give me a good reason why I should go ahead and try to make your program tell me, and I'll be on my way.
slashdot is offline   Reply With Quote
Old 07-10-2005, 01:46 PM   #6 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Do you know how to make basic classes?
__________________
Valmont is offline   Reply With Quote
Old 07-18-2005, 10:41 AM   #7 (permalink)
slashdot
Registered User
 
Join Date: Dec 2004
Posts: 43
slashdot is on a distinguished road
Actual Val (is Val alright?) I don't think I know how to make classes. I have only been read somewhere around 120 pages in C++ for dummies and a couple sources online. So ya, I'm not pro C++ haxer yet. Maybe a simpler test. I'm not sure what to tell you other then I've only goten up to pointer variables.
slashdot is offline   Reply With Quote
Old 07-19-2005, 02:36 AM   #8 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Make code that removes the first encountered substring from a C-style string.
I want you to explain every line of code. You need to prove you'understand char* handling.

Like this:
char* theString = "Life is hard, then you die.";
remove_substring(theString, "hard");
//theString = "Life is, then you die."
__________________
Valmont is offline   Reply With Quote
Old 07-22-2005, 06:12 AM   #9 (permalink)
slashdot
Registered User
 
Join Date: Dec 2004
Posts: 43
slashdot is on a distinguished road
Ok sry if I am complaining to much, but those seem to hard for me. Heres what I have read so far...

Initializing variables, boolean statements, functions, loops, pointers, pointer variables (I think), and now I'm am reading on classes. There may be a couple more I am missing, but I am sure it can be filled in easily.
slashdot is offline   Reply With Quote
Old 07-22-2005, 06:59 AM   #10 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,161
Belisarius is on a distinguished road
That second example is really pretty simple - you should be able to do it with only the programing elements you said you've covered.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 07-23-2005, 09:42 AM   #11 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Quote:
Originally Posted by slashdot
Ok sry if I am complaining to much, but those seem to hard for me. Heres what I have read so far...

Initializing variables, boolean statements, functions, loops, pointers, pointer variables (I think), and now I'm am reading on classes. There may be a couple more I am missing, but I am sure it can be filled in easily.
Learn the ways of:
strcat, strcpy, strncpy, strncat
I do this for a purpose you know. If you don't know about functions then no problem whatsoever. Just make everything work in main().
__________________
Valmont is offline   Reply With Quote
Old 07-23-2005, 11:54 AM   #12 (permalink)
slashdot
Registered User
 
Join Date: Dec 2004
Posts: 43
slashdot is on a distinguished road
Hey you know what I just got past those in my book the other day. I'll take a crack at your quiz alright? I'll be back with it in a day or a day and half.. thanx for taking some time to make a quiz for me!
slashdot is offline   Reply With Quote
Old 08-04-2005, 01:25 PM   #13 (permalink)
fp_unit
mike
 
Join Date: Jan 2005
Location: Ottawa, ON
Posts: 79
fp_unit is on a distinguished road
Quote:
Originally Posted by Rashakil Fol
Reverse Polish Notation is a way of writing mathematical notation in which the operators go after the arguments, which does not require parentheses. For example, 3 5 + simplifies to 8, and 4 7 * simplifies to 28. If you write 1 2 3 + +, first the 2 3 + simplifies to 5, then 1 5 + simplifies to 6. The quadratic formula, normally written (-b + sqrt(b*b - 4*a*c)) / (2 * a), would be written as

b b * a c * 4 * - sqrt b - 2 a * /

RPN calculators use a stack to evaluate their expressions, and a basic four-function RPN calculator can be written in one line of Perl. Write one in C++. Search on the Web for more information.

I first read this recommendation in a response to an Ask Slashdot question, by the way :-)
If you want the answer just open chapter 4 of "The C Programming Language"

Also if he's new to programming thats probably way over his head.
fp_unit is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
c compiling simple question if13121 Standard C, C++ 1 11-12-2004 05:34 AM
c simple question problem with switch case if13121 Standard C, C++ 1 10-24-2004 09:43 PM
Simple C program Spooky Standard C, C++ 1 10-22-2004 07:26 AM
simple c question if13121 Standard C, C++ 3 10-18-2004 10:20 PM


All times are GMT -8. The time now is 11:59 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting