49,756 Topics

Member Avatar for
Member Avatar for mixelplik

I'm practicing arrrays and in the following program I'm passing a multidimensional array to a function to fill it. This worked with a single dimensional array just fine. (1) Is this bad practice? (2) Do the multi-D arrays work the same way as the regular ones. In the program below …

Member Avatar for mixelplik
0
211
Member Avatar for pem

#include <iostream> #include <string> #include <vector> #include <algorithm> #include <fstream> #include <cstdlib> using namespace std; int main() { string title, nameX, nameY; const int maxData = 20; int data, maxValue; int count = 0; vector<int> v; maxValue = *(max_element(v.begin(), v.end())); for(int a = maxValue; a > 0; a++) { if …

Member Avatar for Moschops
0
119
Member Avatar for sireiz

Hi, I want to put urdu language text in a software to be searched. How can i do that? Software is like a lot of text and people can search through it to find specific sections or parts. And for those who don't know urdu, it is written like arabic.

Member Avatar for triumphost
0
122
Member Avatar for Fahad_3
Member Avatar for triumphost

Why is accessing data in an uninitialised array undefined behaviour? I ask because I was doing some benchmarking on `vector<int>` vs. `int*` vs. `int**`. My results were: http://stackoverflow.com/questions/20863478/class-using-stdvector-allocation-slower-than-pointer-allocation-by-a-lot Now I'm being told if I use the raw array and try to access an index without initialising it first, it is …

Member Avatar for mike_2000_17
0
190
Member Avatar for muhammadmuzzammil1998

Here is the code for GUI in C++, http://facebook.com/muhammadmuzzammil1998 Tested in Code::Blocks hope it will help you :) #include <windows.h> /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "CodeBlocksWindowsApp"; int WINAPI WinMain …

0
281
Member Avatar for James19142

I'm new to Visual Studio & trying to build an application in it for the first time. The code compiles. I used to get the error load from the debugger as a result of not downloading the corresponding .pdb files. After changing a setting in the debugger options, all the …

Member Avatar for James19142
0
1K
Member Avatar for viovicente

Hey ahm Im newby when it comes to C++ ahm can anyone help me, 'cuz I can't find answers for some of my questions, I actually go to youtube mostly but most of the videos there is not more satifying.. hehehe.. thanks.

Member Avatar for Moschops
0
70
Member Avatar for mike_2000_17

# Introduction # The subject of this tutorial is a bit more advanced than the subjects I have tackled in the past, but I hope this will find some interested readers. From time to time in C++, programmers find themselves torn apart between using a *Generic Programming* style which primarily …

2
2K
Member Avatar for mixelplik

#include <iostream> #include <iomanip> using namespace std; int main() { cout << "\n0----------------------1------8\n"; cout << setw(22) << left << "Registration Fee "; cout << setw(8) << right << fixed << setprecision(2) << "$ " << 22.0 << endl; cout << setw(22) << left << "Hotel Total "; cout << setw(8) …

Member Avatar for mixelplik
0
189
Member Avatar for Damian_2

Okay so I have `MainShop`(base class) then `SwordShop` and `BowShop`(derived classes) and another derived class called `Inventory`. I have a vector under protected in my base class, and when I access it from my derived classes it's okay, but each one has its own value. How can I set them …

Member Avatar for Damian_2
0
237
Member Avatar for ceelos1974

Hi everyone I'm new to c++ but have had some luck so far. But I have of course met a problem. The program I'm making is supposed to find a a unkown file with an ID. The onliest thing I know of the file is the folder its in. so …

Member Avatar for Ancient Dragon
0
409
Member Avatar for cambalinho

i'm building the label1 class, but i'm getting bad results... so i ask: how can i use the SetWindowLongPtr() for use a window procedure? (i can show the label and change it's properties... but i'm getting problems for active it's own window procedure :( ) see the entire code\class: #include …

Member Avatar for cambalinho
0
837
Member Avatar for Builder_1

what are the differences of string and cstring header files and how does the pre defined function of strcmp which is called string comparison works???? i know it gives 0 if string 1 = string 2 gives +ive and -ive if str1 is greater or less but it calculates that …

Member Avatar for Builder_1
0
7K
Member Avatar for tom.scott.73113

Hi Im working on a program at the moment and seem to be having issue with this section when trying to get section 3 i get section 2 Ive pasted code below any help or suggestions would be great. Thanks if(gps=='Y'||gps=='y'&&childseat=='N'||childseat=='n') { if(stoi(daysamount)<=3) { extra=stoi(daysamount)*5; } else { extra=15; } …

Member Avatar for tom.scott.73113
0
131
Member Avatar for Raja.rahmanway

hello all.. I raja from indonesia wanna ask about gsl in c++ and can you give me some example program source about it?? because i wanna take a some examination about it :D thaks..

Member Avatar for Ancient Dragon
0
44
Member Avatar for Labdabeta

I need to know which of these three copies of code is considered best. I also need to which one is more efficient memory wise and which is more efficient time wise. Thanks: enums [CODE]enum MyEnum{EnumTypeOne=1,EnumTypeTwo=2,EnumTypeThree=4,EnumTypeFour=8};[/CODE] macros [CODE]#define EnumTypeOne 1 #define EnumTypeTwo 2 #define EnumTypeThree 4 #define EnumTypeFour 8 typedef …

Member Avatar for Ancient Dragon
0
1K
Member Avatar for sam7777777

hi friends ... this is my 1st post I'm sure it gonna be beneficial to me.. Well I'm facing problem in this assignment.As I'm not that good in c++ programming. Please help me out .We have to use doubly linked list. **Assignment requirements Overview** You are expected to write a …

Member Avatar for Moschops
0
946
Member Avatar for Alya_1

the given question is 2x+3y-z=5 x-y+z=1 3x+2y+2z=6 i'm supposed to get the values of x,y,z from this coding. #include <iostream> #include <cmath> using namespace std; void GetMat (float A[10][11], int numrow, int numcol); // to enter elements in a 2 dimension matrix void DispMat (float A[10][11], int numrow, int numcol); …

Member Avatar for Alya_1
0
290
Member Avatar for nicholas.f.fortino
Member Avatar for mike_2000_17
0
136
Member Avatar for safoin
Member Avatar for rmsh92

Write a C++ program that reads data from a data file called “temp.dat”. The data file contains a maximum of 31 daily integer temperature values for a city. Your program should continue displaying the following menu until the user selects exit (option No. 6). Head of the data Tail of …

Member Avatar for dresha
0
210
Member Avatar for tiverton

I am writing a DOS screen football game(No graphics), I have reached 61,283 lines any bigger than this I get a error that says linker warning, exceeded memory limit for block line cache in module. Old compiler version 4.0.

Member Avatar for tiverton
0
259
Member Avatar for sadia.rasheed.9231

plz help me , need a code that search a word for file saved in note pad in show the out put as is this wrd exsist in file or not n if yes how many time appear....

Member Avatar for Moschops
0
334
Member Avatar for RASHA_T

Hello everybody! I need some help in my program it is about Guess number game. the program is working but not that I have expected, when i enter guess 76 the output gives me that 76 is Too small :( instead of Too big .Even I type any number 64,99 …

Member Avatar for RASHA_T
0
235
Member Avatar for Vasthor

isShorter(const string &s1, const string &s2) { return s1.size() < s2.size(); } stable_sort(ret.begin(), ret.end(), isShorter); either using stable_sort or sort the result is shown in the attachment. meanwhile: "By calling stable_sort, we can maintain alphabetical order among those elements that have the same length:" - C++ Primer 5th edi. which …

Member Avatar for deceptikon
0
192
Member Avatar for SHE.RE

give an example for a C++ program that sorts list of integers. The list should have a size of power of two. Example: list size = 2, 4, 8, 16… Algorithm 1. Divide the array into two lists until a single element remains in any list While merging given two …

Member Avatar for vani krishnan
0
86
Member Avatar for SHE.RE

give example of a C++ program that sorts list of integers. The list should have a size of power of two. Example: list size = 2, 4, 8, 16… Algorithm 1. Divide the array into two lists until a single element remains in any list While merging given two sorted …

Member Avatar for ddanbe
0
101
Member Avatar for D8FMwyGG

write a program in which a class has three data members: name, ID, marks of 5 subjects (int marks[5]) and a member function Assign() to assign the streams on the basis of table given below: Avg.Marks Stream 90% or more Computers 80% - 89% Electronics 75%-79% Mechanical 70%-74% Electrial In …

Member Avatar for deceptikon
-2
182
Member Avatar for Smartboy33

Can anyone please tell me how to use the built in graphics in c++.Is there any tutorial on this?Which graphics will be suitable for using in c++?If there is any tutorial on this,please give the link. Thanks in advance.

Member Avatar for Moschops
0
539

The End.