Click here to Skip to main content
15,911,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionFree Skin System Pin
Allad4-Feb-06 16:43
Allad4-Feb-06 16:43 
AnswerRe: Free Skin System Pin
EXTEIDE5-Feb-06 1:11
EXTEIDE5-Feb-06 1:11 
Questionmemory leak with dll Pin
Rhiakath4-Feb-06 14:43
Rhiakath4-Feb-06 14:43 
AnswerRe: memory leak with dll Pin
Stephen Hewitt4-Feb-06 18:29
Stephen Hewitt4-Feb-06 18:29 
AnswerRe: memory leak with dll Pin
Rama Krishna Vavilala5-Feb-06 6:47
Rama Krishna Vavilala5-Feb-06 6:47 
Questionprinter problem Pin
includeh104-Feb-06 14:25
includeh104-Feb-06 14:25 
AnswerRe: printer problem Pin
Gary R. Wheeler5-Feb-06 2:04
Gary R. Wheeler5-Feb-06 2:04 
QuestionHelp with setting values to char arrays (strings); Pin
Coolarj104-Feb-06 10:07
Coolarj104-Feb-06 10:07 
I have a problem with this code, if anyone could please help me out, I would greatly appreciate it! I'm trying to make a program that has a certain number of 'char arrays.' When the program starts, it's supposed to randomly concatentate any of the two strings. My program has a problem in four lines of code, and I don't understand how to do it any different. Thank you for your time and help! (P.S., though this snippet of code only shows 4 different strings, my actual program will have at least 25);

//Test program. The object of this program is to
//have different strings randomly concatenate


#include <iostream>
#include <windows.h>
using namespace std; //or #include <stdio.h>, depending on the compiler
#include <string.h>



int main()
{
srand(GetTickCount());
char word[4][128]; //I want to store different strings into word[0], word[1], word[2], and word[3]

word[0][128] = "word1"; //This is set of four lines is where the problem is
word[1][128] = "word2";
word[2][128] = "word3";
word[3][128] = "word4"; //----end of the problem


int firstword;
int secondword;

firstword = rand() % 4;
secondword = rand() % 4;

strcat(word[firstword], word[secondword]);

cout << ""<< word[firstword] <<"";



cin.ignore();


return 0;
}
AnswerRe: Help with setting values to char arrays (strings); Pin
Gary R. Wheeler4-Feb-06 10:54
Gary R. Wheeler4-Feb-06 10:54 
AnswerRe: Help with setting values to char arrays (strings); Pin
meinhard_risch4-Feb-06 13:14
meinhard_risch4-Feb-06 13:14 
AnswerRe: Help with setting values to char arrays (strings); Pin
Coolarj104-Feb-06 14:37
Coolarj104-Feb-06 14:37 
GeneralRe: Help with setting values to char arrays (strings); Pin
Gary R. Wheeler5-Feb-06 2:27
Gary R. Wheeler5-Feb-06 2:27 
GeneralRe: Help with setting values to char arrays (strings); Pin
meinhard_risch5-Feb-06 3:45
meinhard_risch5-Feb-06 3:45 
QuestionMFC Pin
sidkraft4-Feb-06 6:39
sidkraft4-Feb-06 6:39 
Questionhtml-based modless Windeow Pin
meinhard_risch4-Feb-06 6:22
meinhard_risch4-Feb-06 6:22 
AnswerRe: html-based modless Windeow Pin
EXTEIDE4-Feb-06 9:40
EXTEIDE4-Feb-06 9:40 
AnswerRe: html-based modless Windeow Pin
meinhard_risch4-Feb-06 13:32
meinhard_risch4-Feb-06 13:32 
GeneralRe: html-based modless Windeow Pin
EXTEIDE4-Feb-06 14:30
EXTEIDE4-Feb-06 14:30 
GeneralRe: html-based modless Windeow Pin
meinhard_risch5-Feb-06 3:40
meinhard_risch5-Feb-06 3:40 
GeneralRe: html-based modless Windeow Pin
EXTEIDE5-Feb-06 3:58
EXTEIDE5-Feb-06 3:58 
GeneralRe: html-based modless Windeow Pin
meinhard_risch9-Feb-06 10:48
meinhard_risch9-Feb-06 10:48 
QuestionAudio audition with WMP? Pin
Jim A. Johnson4-Feb-06 6:11
Jim A. Johnson4-Feb-06 6:11 
AnswerRe: Audio audition with WMP? Pin
EXTEIDE4-Feb-06 8:52
EXTEIDE4-Feb-06 8:52 
QuestionVideo Setting Pin
Hamid_RT4-Feb-06 3:50
Hamid_RT4-Feb-06 3:50 
QuestionHow To Add Menu To Program ? ? ? Pin
Morfix4-Feb-06 3:00
Morfix4-Feb-06 3:00 

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.