174 Topics

Member Avatar for
Member Avatar for swoshromp

What my problem is I don't know how do I set it up so that when the entire word has been guessed I can stop the game and tell the user they won or lost. I tried adding in another if statement after maxTries--; where it says if (maxTries == …

Member Avatar for JeffGrigg
0
253
Member Avatar for thendrluca

This is my first post on daniweb :) and i am a beginner in C programming and i don't know so good english :) sorry! This is my program My problem consist of I run the program and i can't get to the [B]scanf("%c",&q);[/B] [I]/* Row 21 after printf. */[/I], …

Member Avatar for thendrluca
0
325
Member Avatar for Knar

Ey all. Im folowing a c++ course and im stuck writing string or char arrays to matrices. The problem is i have a matrix of size [i][j] with random values from 0 to 3. Each of these values have to correspond to either a string or char array. 0=EMPTY 1=RES …

Member Avatar for Greywolf333
0
415
Member Avatar for Oscariuz

Hi guys im trying to make a program that will work as " Slot Machine " and im stuck in one part that i can not resolve. Im trying to verify predetermined char in random array so i can know if some of the three char appear three times or …

Member Avatar for mrnutty
0
208
Member Avatar for Oscariuz

Hi guys im trying to make a program that will work as " Slot Machine " and im stuck in one part that i can not resolve. Im trying to verify predetermined char in random array so i can know if some of char appear three times or more. I …

Member Avatar for mzimmers
0
177
Member Avatar for caswimmer2011

Hey, Is there a way to get the keycode from a char? I tried using KeyEvent.getKeyCode() but the KeyEvent class didn't have a constructor so it was freaking out. I've been searching for 2+ hours already and nothing. My goal is to have a char, convert it to keycode, and …

Member Avatar for caswimmer2011
1
954
Member Avatar for anu07

The output I expected was: [ICODE]alpha beta[/ICODE] I used the following code: [CODE]#include<iostream.h> #include<conio.h> void main() { clrscr(); char choice[2][5]={"alpha","beta"}; cout<<choice[0]<<endl; cout<<choice[1]; getch(); }[/CODE] But this is what comes: [ICODE]alphabeta beta[/ICODE] Can anyone tell me what I did wrong? Thank you. P.S.:I know I am not using standard c++, but …

Member Avatar for anu07
0
173
Member Avatar for Mahkoe

So I'm trying to achieve this myself, but I decided to ask on this forum to see if anyone knew about some obscure project on sourceforge or something that did exactly this: I need to store very large numbers and perform arithmetic on them. I am storing the values in …

Member Avatar for mike_2000_17
0
242
Member Avatar for loveMii

Hello.. I've been trying to create a simple postfix calculator.. Can anyone please tell me how I can input a char in assembly? i tried using char as a data type but i found out that there's no such thing as char in assembly.. Please help me.. thanks!

Member Avatar for loveMii
0
6K
Member Avatar for Mahkoe

I realize there are many ways to store large numbers in c++ (and by large I mean too large for long doubles), but none of them were really what I was looking for. I don't just need to store large numbers in which case I would use GMP or something, …

Member Avatar for Mahkoe
0
181
Member Avatar for c++creator

Hey everybody,it's the c++ creator.I am a beginner at C++,and am getting confused at functions.I am learning from a site called cprogramming.com and this is what they say- [QUOTE]Lesson 4: Functions (Printable Version) Now that you should have learned about variables, loops, and conditional statements it is time to learn …

Member Avatar for frogboy77
0
562
Member Avatar for Museless

I am trying to find out how to replicate the output of fwrite("andbe", 4, 1, output); an encryption algorithm I am using writes its output as this, but I am sending data across a network, and need to be able to write this to a string to send. The algorithm …

Member Avatar for thines01
0
163
Member Avatar for vishal1949

I just wanted to know what would happen if you abuse the CharStack class by pop()ing more characters than you push()? Would it be an error of out of exception or something else.

Member Avatar for JamesCherrill
0
215
Member Avatar for IndianaRonaldo

[CODE]void SubGen(char* s) { //rearrange s ... for(int i=0;i<strlen(s);i++) { for(int j=i+1;j<strlen(s);j++) { if(s[i]==s[j]) { char temp=s[i+1]; s[i+1]=s[j]; s[j]=temp; } } } //s arranged.... Sub[0][0].push_back(s[0]); for(int i=1;i<strlen(s);i++) { if(s[i]==s[i-1]) { vector<string> temp; for(int j=i-1;j<Sub.size();j++) { for(int p=0;p<Sub[j].size();p++) { temp.push_back(Sub[j][p]); } } for(int j=0;j<temp.size();j++) { temp[j].push_back(s[i]); } Sub.push_back(temp); } else { …

Member Avatar for IndianaRonaldo
0
213
Member Avatar for Mahkoe

I've been coding in c++ for a while now, and I use string variables quite a lot. One day, I stumbled upon a char* which can also be used to "store" a string of characters, and it's been bothering me ever since that I don't really know what a string …

Member Avatar for Mahkoe
0
179
Member Avatar for ShadowBorn

I have this assignment due and its a bit tricky, i was wondering how is it possible to incoporate both C-string and a [I]string[/I] object at the same time. Any help would be very very appreciated. thank you all in advance. Here is the actual problem from the book. [B]Write …

Member Avatar for NathanOliver
0
142
Member Avatar for Labdabeta

This is a conversion question that has me stumped. I need to convert an unsigned char to a signed float. Some examples: 0xFF becomes 1.0f 0x00 becomes -1.0f 0x80 becomes ~0.0f The only idea that I could come up with was a massive switch statement. But a switch statement will …

Member Avatar for ddanbe
0
337
Member Avatar for WolfShield

Hey all, I am working on a calculator program and am using a StringVar() for the Entry widget. What I need is to delete the last char from the StringVar() when the user hits the 'Backspace' button. I have everything bound and all, I just don't know what the code …

Member Avatar for WolfShield
0
1K
Member Avatar for EkoX

Hello All, As the title.. Does any one know how to find how many specific character in a text? Best Regard Eko.

Member Avatar for Jx_Man
0
153
Member Avatar for anitaNg

what is wrong with my code?i cant figure it out. [CODE] #include<iostream.h> #include<stdlib.h> #include<stdio.h> #define MAX 50 struct Node { char judul[MAX]; char pengarang[MAX]; int harga; Node* nextPtr; }; Node* makeNode(char judul[], char pengarang[], int harga) { Node* newNodePtr = (Node*)malloc(sizeof(Node)); if(newNodePtr == NULL) { cout << "Out of Memory" …

Member Avatar for jonsca
0
140
Member Avatar for TheSassyDragon

Im trying a practice problem from a textbook and here is my attempt at it, was wondering if I could get some advice both with structurally how to approach the problem, efficency, and any words of wisdom on dynamic memory. This is my study for my final exam which so …

Member Avatar for Lerner
0
271
Member Avatar for bensewards

Hey everyone, I have to manipulate two functions RECURSIVELY, strlen and strcpy. I was able to code the strlen: [CODE]int length(char* str){ if(str == NULL){ return 0; }else{ return length(str, 0); } } int length(char* str, int l){ int len=0; if(str[l]){ len = length(str,l+1); } else { return l; } …

Member Avatar for bensewards
0
746
Member Avatar for djbuclkle

I am currently writing a program in which you input a word and the program then outputs all of the different ways the characters can be moved round into anagrams. I have wrote a way of turning the command line argument into a char array using the toCharArray() now I …

Member Avatar for JamesCherrill
0
168
Member Avatar for LanguidLegend

Hi everyone, I'm new to this site and hope you might be able to help me out? So I've been given an assignment to produce this output [CODE]% ./hw4b foo here foo and foo there % ./hw4b ABC123 here ABC123 and ABC123 there % ./hw4b 'where is' here where is …

Member Avatar for Ancient Dragon
0
326
Member Avatar for jackmaverick1

Hi, I just started Java (But I do have 1.5 years in c++) and I found that string switchs aren't allowed, so I tried using a character array, now when I try to define the array, it says that [ICODE]char [10 for example]array;[/ICODE] is not allowed because of [10 for …

Member Avatar for JamesCherrill
0
92
Member Avatar for beejay321

so im trying to build a connect 4 gameboard using charecter arrays and it has to look like this O | O | O | O ------------- O | O | O | O ------------- O | O | O | O ------------- O | O | O | O …

Member Avatar for WaltP
0
845
Member Avatar for Khoanyneosr

[CODE] #include <iostream> #include <ctime> #include <cstdlib> #include <string> #include <algorithm> using namespace std; //Types and Arrays string word[16] = {"GOLDFISH", "COMPUTER", "ANONYMOUS", "JACKET", "SHARP", "SERVICE", "EFFORT", "CHARACTER", "CHANGE", "WITHOUT", "PRODUCT", "UNFOLDING", "MUSIC", "MOMENT", "LIFETIME", "PROVIDE"}; // words that will be randomized. string hint[16] = {"Small colorful fish.", "A machine …

Member Avatar for daviddoria
0
186
Member Avatar for Mahkoe

Why use const char* instead of string? I see it all over the place. Personally, I prefer strings.

Member Avatar for mike_2000_17
0
1K
Member Avatar for Khoanyneosr

So, I need to find a way to create a way for the computer to ask for input, for this example lets make it 1 and 2. 1 for yes and 2 for no. [CODE] int yes; int no; cout << Do you like orange chicken?" << endl; cout << …

Member Avatar for Khoanyneosr
0
387
Member Avatar for Khoanyneosr

[CODE] #include <iostream> #include <ctime> #include <cstdlib> #include <string> #include <algorithm> using namespace std; // Functions int instructions(); int game(); //Types and Arrays string word[] = {"GOLDFISH", "COMPUTER", "ANONYMOUS", "JACKET", "SHARP", "SERVICE", "EFFORT", "CHARACTER", "CHANGE", "WITHOUT", "PRODUCT", "UNFOLDS", "MUSIC", "MOMENT", "LIFETIME", "PROVIDE"}; char guess[50]; char inst[50]; int main() { cout …

Member Avatar for pseudorandom21
0
1K

The End.