944,132 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 1984
  • C++ RSS
Dec 28th, 2004
0

Problems with character strings

Expand Post »
Well hallo comrades, just been having problems with character strings. Wrote a program that requires typing in of information yet it wasn't possible to represent the character strings in a comfortable manner for whoever is to use the program. Also is there a possible way to make the inputing of a password be in a format not seen by another during input e.g. ******* characters during input. Still polishin on proceedural programming C++. Sent a program with its executable part as an attachment. Just a simple one, any opinions on how to make a more realistic and useful program? Phone number to begin the program is 720797278. Gud day!
Attached Files
File Type: cpp SELF EVALUATION PROGRAM VERSION 3!.CPP (10.9 KB, 9 views)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Caesar Were is offline Offline
1 posts
since Dec 2004
Dec 28th, 2004
0

Re: Problems with character strings

Hi there I took a look at the code and yes there is a MUCH better way to get it to be user friendly. Have you thought about the use of the ANSI c++ string class (#include <cstring>)? I believe there is a code snippet showing some functions on the c/c++ snippets forum. If not try http://www.msoe.edu/eecs/ce/courseinfo/stl/string.htm as a guide. This will allow your users to input text and allows you to analyze their input! if you want options/multi-choice questions then I would stick with numbering the responses. Hope this helps
Reputation Points: 16
Solved Threads: 6
Posting Pro in Training
1o0oBhP is offline Offline
445 posts
since Dec 2004
Dec 28th, 2004
0

Re: Problems with character strings

i had another look and realised its pretty much multiple choice so the string class may not be that simpler. however use of a switch statement would clean up the code a bit

C++ Syntax (Toggle Plain Text)
  1. switch (variable)
  2. {
  3. case value1:
  4. {
  5. // process code if variable == value1
  6. }
  7. break;
  8. case value2:
  9. {
  10. // process code if variable == value 2
  11. }
  12. default:
  13. {
  14. // no matches, process code if variable did equal any of the cases
  15. }
  16. break;
  17. };

again a google seach for the switch statement should proove useful.
Reputation Points: 16
Solved Threads: 6
Posting Pro in Training
1o0oBhP is offline Offline
445 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Urgent:need Help
Next Thread in C++ Forum Timeline: Reversing a string?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC