49,761 Topics
| |
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: // … | |
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> … | |
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 … | |
/* 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; … | |
/* 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 … | |
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 … | |
#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 … | |
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 … | |
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 … | |
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, … | |
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 … | |
> *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 … | |
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 … | |
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 … | |
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 … | |
Hi everyone, please anyone help me... My program is correctly compiled but not runnig? What would be the problem in my program?? | |
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 … | |
// 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:= … | |
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 … | |
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', … | |
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 … | |
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]; … | |
#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; } | |
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. | |
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> … | |
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? | |
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 … | |
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? |
The End.