Click here to Skip to main content
16,007,932 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Characters and strings Pin
toxcct27-Apr-04 1:57
toxcct27-Apr-04 1:57 
GeneralRe: Characters and strings Pin
David Crow27-Apr-04 2:11
David Crow27-Apr-04 2:11 
GeneralRe: Characters and strings Pin
Garth J Lancaster27-Apr-04 2:25
professionalGarth J Lancaster27-Apr-04 2:25 
GeneralRe: Characters and strings Pin
David Crow27-Apr-04 2:34
David Crow27-Apr-04 2:34 
GeneralRe: Characters and strings Pin
Garth J Lancaster27-Apr-04 2:44
professionalGarth J Lancaster27-Apr-04 2:44 
GeneralRe: Characters and strings Pin
David Crow27-Apr-04 3:02
David Crow27-Apr-04 3:02 
GeneralRe: Characters and strings Pin
Garth J Lancaster27-Apr-04 3:24
professionalGarth J Lancaster27-Apr-04 3:24 
GeneralRe: Characters and strings Pin
Garth J Lancaster27-Apr-04 2:20
professionalGarth J Lancaster27-Apr-04 2:20 
While 'Anonymous' is technically correct, we do help people who show us some code they have attempted..

I'm providing a link to a site that has a fairly good intro to c++ - my suggestion is that you go there first, read the notes etc - you probably have some notes your teacher gave you - read those as well - dont be worried about it not sounding right the first time - take a break, read and re-read ...

http://cplus.about.com/library/blcplustut.htm[^]

Once you've done that, you should then break down your question into individual 'logical' operations - for example, you might start like this for Q1 :-

a) define the 'stop'/'certain' character

b) read a character from the keyboard

c) test if the character is the character defined at (a)

d) if (c) is false, store the character - you may need an array for this, then you/the program need to go back to (b)

e) if (c) is true, you may need to look (loop) through all the elements in the array, printing them out .. you may decide that at (d), you may also need to keep a count of the elements .. so modify step (a) to now read

(a) define the 'stop'/'certain' character, a counter to count how many characters are being entered (hint : int), and an array of characters (you may need to define a large array if you havnt thought of how man characters you want to store),

and modify step d) to include 'increment the counter'

you may decide that the easy way to do the test and 'loop' bit is to take a look at 'while loops'

once you have something that can save and print every character, then, make a copy of it for safe keeping, and alter it to handle the double space reduction issue .. again, write down what you need to achieve, break it into logical steps, then its easier to convert into code .. this goes for any language, wether thats c++, perl, whatever

many people will offer you solutions to the problem - there are a lot of ways to solve it .. but you are better off (as we say down here in Australia) 'having a go' and posting back here with something you've attempted.

think 'what can go wrong' - 'what have I assumed' - if you manage to declare a counter at 'a', is it fair to assume the the compiler set it to zero (I tell you its not, so, at (a), you might also want to add the step 'set the counter to zero')

do you see what Im doing - breaking down the problem, designing and then refining my design ...

I hope this has started you on the right foot - other people will probably shoot me for doing it this way ..

if all else fails, see your teacher/lecturer, even then, you shouldnt go to them with no ideas of your own

'G'
GeneralRe: Characters and strings Pin
John R. Shaw27-Apr-04 7:11
John R. Shaw27-Apr-04 7:11 
GeneralRe: Characters and strings Pin
Garth J Lancaster27-Apr-04 11:32
professionalGarth J Lancaster27-Apr-04 11:32 
Generalboost::thread Pin
Andrew Walker27-Apr-04 1:20
Andrew Walker27-Apr-04 1:20 
GeneralRe: boost::thread Pin
Garth J Lancaster27-Apr-04 2:31
professionalGarth J Lancaster27-Apr-04 2:31 
GeneralRe: boost::thread Pin
Andrew Walker27-Apr-04 2:52
Andrew Walker27-Apr-04 2:52 
GeneralCRecordset problem Pin
FASTian27-Apr-04 1:09
FASTian27-Apr-04 1:09 
Questionhow to get the return value of URL Pin
Anonymous27-Apr-04 1:06
Anonymous27-Apr-04 1:06 
GeneralUser Interface (Advice Required) Pin
Imtiaz Murtaza27-Apr-04 0:45
Imtiaz Murtaza27-Apr-04 0:45 
GeneralRe: User Interface (Advice Required) Pin
Andrew Walker27-Apr-04 0:53
Andrew Walker27-Apr-04 0:53 
GeneralRe: User Interface (Advice Required) Pin
David Crow27-Apr-04 2:15
David Crow27-Apr-04 2:15 
GeneralCRichEditCtrl - CFE_LINK , how can i repaint it Pin
markoot27-Apr-04 0:39
markoot27-Apr-04 0:39 
GeneralCMDIChildWnd Pin
alex.barylski27-Apr-04 0:39
alex.barylski27-Apr-04 0:39 
GeneralRe: CMDIChildWnd Pin
Adi Narayana27-Apr-04 2:30
Adi Narayana27-Apr-04 2:30 
GeneralRe: CMDIChildWnd Pin
britonleap26-Jun-04 9:36
britonleap26-Jun-04 9:36 
GeneralMainFrame Customization Pin
MasterOfBytes27-Apr-04 0:37
MasterOfBytes27-Apr-04 0:37 
Generalodbc for sybase Pin
quicklwl26-Apr-04 23:39
quicklwl26-Apr-04 23:39 
GeneralDirectShow: add compressor filter Pin
tttonyyy26-Apr-04 23:05
tttonyyy26-Apr-04 23:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.