49,761 Topics

Member Avatar for
Member Avatar for nathan.pavlovsky

Hello programmers! I have been working on STL algorithms for some time now as a beginner, and I started doing an exercise, among which is the task of `use the fill algorithm to fill the entire array of strings named items with "hello"`. My code for this is below: // …

Member Avatar for nathan.pavlovsky
0
2K
Member Avatar for lewashby

In the following program I'm getting the warning -> unused variable ‘fn’. I'm following along with a book so I don't know why it gave me that portion of code if it's unusable. Also, I don't understand this line at all. -> `void(*fn)(int& a, int* b) = add;` #include <iostream> …

Member Avatar for sepp2k
0
189
Member Avatar for sbesch

I am interested in getting some opinions on the use of include files to sub-divide a large module into functionally related groups. What I'm interested in is opening a discussion on best practices and minimal requirements. Here's the scenario: I am working with a library with 200+ functions. They naturally …

Member Avatar for mike_2000_17
0
276
Member Avatar for Fazelessmetal

/* USE IT HOWEVER YOU WANT :D */ #include <iostream> #include <string> #include <fstream> #include <cstdlib> using namespace std; char name[100]; wchar_t words[100]; int choice; int chmon; int level; int main (int argc, char *argv[]) { //main string used("this game is cool"); string in; cout<<"Hello Welcome to the Code Game!"<<endl; …

Member Avatar for ddanbe
0
175
Member Avatar for Fazelessmetal

/* Written by HAYZAM SHERIF ! USE IT HOWEVER YOU WANT :D */ #include <iostream> #include <string> using namespace std; char name[100]; wchar_t words[100]; int choice; int main() { //main string userstring; string mystring; mystring = "THIS GAME IS COOL"; cout<<"Hello Welcome to the Code Game!"<<endl; cout<<"--------------x----------------"<<endl; cout<<endl; cout<<"Please enter …

Member Avatar for deceptikon
0
168
Member Avatar for Jjajangmyeon

I've hit a wall. I'm trying to open a .txt file and then copy it's contents into an array of character arrays. Can someone point in me in the right direction. I've been at this for about 2 days now and haven't made any head way. Below is a sample …

Member Avatar for Jjajangmyeon
0
11K
Member Avatar for Fazelessmetal

#include <iostream> #include <string> using namespace std; int main() { string x; cout<<"Enter Text : "<<endl; cin>>x; getline(cin,x); cout<<"The text entered was, "; cout<<x; system("PAUSE"); return 0; } Output that I get when I enter 1 word : Enter Text : LOL The text entered was, Press any key to …

Member Avatar for NathanOliver
0
347
Member Avatar for myk45

Hi, I have a Qt based tool and I want to add a QtWidget(button) in the gui which will act as a help button for my tool just like the windows help button for any application. The help button when pressed should display some text information in the form of …

Member Avatar for mike_2000_17
0
172
Member Avatar for okeidowu
Member Avatar for messr135

I'm making a word unscrambler, an anagram solver of sorts. So, I've stored all possible variations of the word in storedstrings which is an array of strings. Now, i need to delete all the same strings in storedstrings and then store the unique strings in another array of strings. This …

Member Avatar for David W
0
408
Member Avatar for Jjajangmyeon

I'm writing a program that stores passwords into a char array then checks for 1 upper, lower, number and allows @ - _ . For some reason it won't read the special chars - unless I include this function, but when I do it only evaluates those in the function, …

Member Avatar for Jjajangmyeon
0
146
Member Avatar for Jjajangmyeon

When a user enters multiple keystrokes the meny prints multiple times. It should spit out an error and reprint the menu once...what gives? void mainMenu(char entries[], int index[]) { char choice; cout << "Please choose 1, 2, or 3.\n"; cout << "1. Save a new password\n"; cout << "2. Display …

Member Avatar for Jjajangmyeon
0
114
Member Avatar for daniela.valkanova

> *no instance of function template*maximum* matches the argument list argument types are: (int,int,int)* #include <iostream> using namespace std; template <class T> T maximum(T value) { T maxValue; if (value >= maxValue) maxValue = value; else value = value; return value; } int main() { int number1 = 1; int …

Member Avatar for Sarkurd
0
6K
Member Avatar for Huy_2
Member Avatar for jalferez1

program 1. create a program that accepts strings and syntactically analyze it whether it belongs to the language defined by the BNF below: BNF: <VD>-><DT><VL>; <DT>->char|float|int|double <VL>-><V>|<V>,<VL> <V>->'any valid variable name' program 2. valid assignment statement BNF: <AS>-><ID>=EXP>; <ID>->a|b|c|d <EXP>-><EXP>+<TERM>|<EXP>-<TERM>|<TERM> <TERM>-><ID>|'('<EXP>')' I NEED HELP. THANKS:)) I'M FINE WITH ENGLISH SPEAKING …

Member Avatar for David W
0
1K
Member Avatar for Daneos

Anyone can help me? I have inventory system which works with item-bags. There are 4 different item-bags. 1 bag have 4 other 8, 12, 16. Now for the NPC shop I need to check if there is a free place in my inventory. Lets say, I have 2 bags. 1 …

Member Avatar for David W
0
211
Member Avatar for Jjajangmyeon

It's giving me an error telling me my reference variable hasn't been initialized. What does that mean, what's wrong with my code here? /* ------ FUNCTION: NEW ENTRY ------------------------------------ ----------------------------------------------------------------*/ void newEntry(char entries[], int index[]) { char buffer[256]; char password[8]; bool val = 0; int &length; cout << "\n------ New …

Member Avatar for Jjajangmyeon
0
6K
Member Avatar for Abeeha sheikh

Hi everyone, please anyone help me... My program is correctly compiled but not runnig? What would be the problem in my program??

Member Avatar for Ancient Dragon
0
144
Member Avatar for Sh4dowz

Hi,I was wondering if anybody had some good C++ tutorial or Books. I want to learn C++ really badly.I really want to start learnig at and early age. I know Java,VB.net but, I need a more powerful language that can do much more.I'm 13 but, don't get me wrong I'm …

Member Avatar for mudasar44
0
379
Member Avatar for rela

// How can I rewrite this loop to C++ from C // I dont know how to define vectors x, z, and v! // x, z, and v are vectors, and N is the number of vectors x and z (N=2). c:= 10; N:= 2; p:= 3; b:=5; for r:= …

Member Avatar for rubberman
0
795
Member Avatar for Jjajangmyeon

This is just a simple menu and I have no clue why it doesn't work. using namespace std; #include <iostream> #include <iomanip> #include <fstream> // ------ Prototypes --------------------------------------------- void mainMenu(); void newEntry(); void display(); void exit(); // ****** MAIN *************************************************** int main() { mainMenu(); return 0; } /* ------ MAIN …

Member Avatar for Jjajangmyeon
0
171
Member Avatar for bella.twins.94

Assuming that a text file named FIRST.TXT contains some text written into it, write a function named vowelwords(), that reads the file FIRST.TXT and creates a new file named SECOND.TXT, to contain only those words from the file FIRST.TXT which start with a lowercase vowel (i.e., with 'a', 'e', 'i', …

Member Avatar for Lucaci Andrew
0
3K
Member Avatar for Gimper

Hello everyone. I recently started using C++ and blah blah blah you know the rest. Using my extremely limited knowledge, I attempted to make a basic 4 function calculator CUI in C++. The code I wrote is as follows. [CODE]#include <iostream> #include <string> #include <sstream> using namespace std; char operator …

Member Avatar for rela
-2
3K
Member Avatar for mixelplik

I'm trying to read a keyboard entry into a 256 char buffer then extract from just the chars entered (trying to restrict it to just 8 characters) I am fundamentally not understanding how the #$%#$^ing char arrays work: #include <iostream> using namespace std; int main() { char buffer[256]; char pw[8]; …

Member Avatar for mixelplik
0
290
Member Avatar for Yogesh_9

#include<iostream> #include<stdlib.h> using namespace std; int readInt() { int cc=getc(stdin); for(;cc<'0'||cc>'9';) cc=getc(stdin); int ret=0; for(;cc>='0'&&cc<='9';) { ret=ret*10+cc-'0'; cc=getc(stdin); } return ret; } int main(void) { int p=readInt(); cout<<p<<endl; return 0; }

Member Avatar for mike_2000_17
0
190
Member Avatar for Nikolas9896

Could you tell me how I can use the .docx file with Visual Studio 2013 but only with C++ code, and in my application **without** using **MS Word** or another wordprocess. Thanks. I wanna change formatting(bold italy, centre..) and text in .docx-files.

Member Avatar for NathanOliver
0
130
Member Avatar for Sarkurd

Hi i'm following a book but i don't understand `std::string::size_type` and some other data types specially `typedef` i see programmers use them too much. typedef int grades[5]; grades studenA[5], studentB[5]; and why just not use `int` instead of `size_type` while the result is same. #include <iostream> #include <string> #include <algorithm> …

Member Avatar for Sarkurd
0
759
Member Avatar for cambalinho

can i declare functions private in header files? imagine that you use a function declared outside the class and you only want be used only by that class... how can i private that function?

Member Avatar for mike_2000_17
0
335
Member Avatar for yaldoo

Okay, I was given this problem, its another of those file I/O streams and I was wondering how I can change this code to be more "efficient" and change a lot of things. I'm having trouble on what I should change and what I should keep. Please help me out …

Member Avatar for David W
0
2K
Member Avatar for nathan.pavlovsky

I was just wondering, what is a good rule of thumb for industrial-grade code when deciding whether to use the std::array template vs a built-in array?

Member Avatar for mike_2000_17
0
1K

The End.