Click here to Skip to main content
15,902,832 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to find that I've select the correct file. Pin
CodingLover12-Nov-07 19:26
CodingLover12-Nov-07 19:26 
AnswerRe: How to find that I've select the correct file. Pin
Malli_S12-Nov-07 21:15
Malli_S12-Nov-07 21:15 
AnswerRe: How to find that I've select the correct file. Pin
chandu00412-Nov-07 21:53
chandu00412-Nov-07 21:53 
NewsRe: How to find that I've select the correct file. Pin
CodingLover13-Nov-07 16:55
CodingLover13-Nov-07 16:55 
AnswerRe: How to find that I've select the correct file. Pin
Nelek13-Nov-07 21:53
protectorNelek13-Nov-07 21:53 
GeneralRe: How to find that I've select the correct file. Pin
CodingLover14-Nov-07 16:27
CodingLover14-Nov-07 16:27 
Questionhi i have problem with displaying controls Pin
chethu66512-Nov-07 19:15
chethu66512-Nov-07 19:15 
QuestionProblem printing c-string Pin
SamRauch0112-Nov-07 18:57
SamRauch0112-Nov-07 18:57 
This is a simple assignment for my c++ class requiring us to convert some text in a char array inline, not using another array. My code compiles with no errors, but when I run the program nothing comes out. I guess somewhere I'm accidently overwriting the entire string to nothing but... yeah. Anyhow, in the array, the following changes are supposed to occur: th -> z, s -> z, and r -> rr. This, of course, requires the entire string to be shifted if in the cases of th -> z and r -> rr. Here is my code:
<br />
#include "stdafx.h"<br />
#include <br />
#include <br />
#include <br />
<br />
using namespace std;<br />
<br />
#define MAX_SIZE 100<br />
<br />
int getLength(char inputText[]);<br />
void moveLeft(char* inputText, int index);<br />
void moveRight(char* inputText, int index);<br />
<br />
<br />
void main()<br />
{<br />
<br />
char text[MAX_SIZE];<br />
<br />
cout << "Enter your words here: ";<br />
cin.getline(text, MAX_SIZE);<br />
<br />
int sizeText = getLength(text);<br />
<br />
int j;<br />
int k;<br />
<br />
for( j = 0, k = 0; j < sizeText; j++, k++)<br />
{<br />
if ( (text[j] == 't' || text[j] == 'T') && (text[j + 1] == 'h' || text[j + 1] == 'H'))<br />
{<br />
text[k]= 'z';<br />
moveLeft(text, k);<br />
j++;<br />
}<br />
else if (text[j] == 'r' || text[j] == 'R')<br />
{<br />
moveRight(text, k);<br />
text[k] = 'r';<br />
text[k+1]= 'r';<br />
k++;<br />
}<br />
else if (text[j] == 's' || text[j] == 'S')<br />
{<br />
text[k] = 'z';<br />
}<br />
<br />
}<br />
<br />
cout << "The new line is: " << text << endl;<br />
<br />
}<br />
<br />
int getLength(char inputText[])<br />
{<br />
int length = 0;<br />
while (inputText[length]!= '\0')<br />
{<br />
length++;<br />
}<br />
<br />
return length+1;<br />
}<br />
<br />
void moveLeft(char* inputText, int index)<br />
{<br />
for (int i = index; inputText[i] = '\0'; i++)<br />
{<br />
inputText[i] = inputText[i+1];<br />
}<br />
}<br />
<br />
void moveRight(char* inputText, int index)<br />
{<br />
for (int i = 100; i > index; i--)<br />
{<br />
inputText[i] = inputText[i-1];<br />
}<br />
}<br />


Any help that you could provide would be greatly appreciated! Thank you!

-Sam
AnswerRe: Problem printing c-string Pin
Malli_S12-Nov-07 21:23
Malli_S12-Nov-07 21:23 
AnswerRe: Problem printing c-string Pin
David Crow13-Nov-07 3:40
David Crow13-Nov-07 3:40 
Questionthread pool Pin
Jhony george12-Nov-07 18:45
Jhony george12-Nov-07 18:45 
AnswerRe: thread pool Pin
Stephen Hewitt12-Nov-07 18:59
Stephen Hewitt12-Nov-07 18:59 
QuestionRe: thread pool Pin
Jhony george12-Nov-07 19:27
Jhony george12-Nov-07 19:27 
AnswerRe: thread pool Pin
Mark Salsbery13-Nov-07 9:01
Mark Salsbery13-Nov-07 9:01 
AnswerRe: thread pool Pin
Rajasekharan Vengalil12-Nov-07 19:15
Rajasekharan Vengalil12-Nov-07 19:15 
QuestionParse excel file Pin
Maynka12-Nov-07 18:45
Maynka12-Nov-07 18:45 
AnswerRe: Parse excel file Pin
Rajasekharan Vengalil12-Nov-07 19:20
Rajasekharan Vengalil12-Nov-07 19:20 
QuestionSolution For Painting multiple images? Pin
Richard Blythe12-Nov-07 17:41
Richard Blythe12-Nov-07 17:41 
AnswerRe: Solution For Painting multiple images? Pin
Llasus12-Nov-07 20:58
Llasus12-Nov-07 20:58 
QuestionHow to mount any file? Pin
bhaskar jatav12-Nov-07 17:37
bhaskar jatav12-Nov-07 17:37 
QuestionADO n DataGrid Pin
SnaKeBeD12-Nov-07 17:33
SnaKeBeD12-Nov-07 17:33 
AnswerRe: ADO n DataGrid Pin
followait12-Nov-07 17:44
followait12-Nov-07 17:44 
GeneralRe: ADO n DataGrid Pin
SnaKeBeD12-Nov-07 18:13
SnaKeBeD12-Nov-07 18:13 
GeneralRe: ADO n DataGrid Pin
SnaKeBeD13-Nov-07 3:48
SnaKeBeD13-Nov-07 3:48 
QuestionHow to Create virtual drive? Pin
bhaskar jatav12-Nov-07 17:25
bhaskar jatav12-Nov-07 17:25 

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.