49,766 Topics
![]() | |
hi guys :D! im trying to make specialized template for cstring, but it seems i stuck on it.. i tried to search how to make specialized template for cstring , but there wasnt any good explanation and im trying to figure this out my self here's my template header : … | |
#include <iostream> #include <vector> using namespace std; template< typename T > using matrix = vector< vector<T> > ; I saw this code snippet while searching for templates. I was wondering why there's a word "using". What is it for? Thanks :) | |
Hello my name is Leonard E. Norwood Jr. I haven't been back much but I'm still studying and practicing C++ I'm still doing arrays starting from beginning to better get used it it. Anyway, it's a simple program of finding the largest number of the 10 numbers. I know my … | |
Hi, In the code below I have 2 nested loops, with the inner loop starts from the index of the outer loop till the end. You can think of it as I am trying to find ll the combinations. So if we have 'm' rows, we will have m(m+1)/2 possible … | |
I don't really have an explanation and whoever thought that this new posting format was the way to go... idk what to say. I really don't like it. I can only post so much lines of code before something happens to the window and I can't scroll all the way … | |
#include <iostream.h> void main() { int d; int i=0,n,j,b[100]; cout<<"\n Press 1 for Decimal to Binary converstion"; cout<<"\n press 2 for Decimal to Octal converstion "; cout<<"\n press 3 for Decimal to Hexadecimal converstion"; cout<<"\n\nEnter your choice: "; cin>>d; switch(d) { case 1: cout<<"\nEnter decimal number: "; cin>>n; while (n>0) … | |
Hi everyone I'm having a problem with this program giving me the wrong output. The question is • void getScore() should ask the user for a test score, store it in a reference parameter variable. This function should be called by the main once for of the six scores to … | |
#include <conio.h> #include <iostream> using namespace std; int main() { int A[10][10],m,n,x,y,sum=0; //Create a Matrix cout << "Enter number of rows and columns in Matrix A : \n"; cin>>n>>m; cout << "Enter elements of Matrix A : \n"; for(x=1;x<n+1;++x) for(y=1;y<m+1;++y) cin>>A[x][y]; //Find sum of each row for(x=1;x<n+1;++x) { A[x][m+1]=0; for(y=1;y<m+1;++y) … | |
I'm not sure what I'm doing wrong. I get a warning when I compile and an error after my program runs. This is the warning I get: myList2.cpp: In function ‘int main()’: myList2.cpp:96: warning: deleting array ‘int score [6]’ And this is what shows after my program runs: a.out(7023) malloc: … | |
Hello, I am currently building a rendering engine in native C++ using Direct3D 10 and the Win32 API. The engine will have 2 separate windows, one being the rendering window and the other being a control window which is used to load models, animaitons, etc. It is also used to … | |
The difference between using refrences(&var), and pointers(*var) is that using refrences is more efficent because you do not have to derefernce the object. Am I right, and if I am why use pointers then? Take this code for example: #include<iostream> //function prototype void rFunc(int &rNum); void pFunc(int *rNum); //main method … | |
I've hook a game that uses OpenGL and I'm trying to draw text on the window but when drawn, it has a background that I do not want. Currently i'm using: void glPrint(HDC DC, COLORREF Colour, int X, int Y, const char* format, ...) { if (format == NULL) return; … | |
Ok, i'm trying to create vertex normals for each vertex. I'm fairly sure i've got the math right, I'm just having trouble finding out to which faces a point belongs... The points are store in: `vector <texTri> texvert` texTri contains, x, y, z, nx, ny, nz, u, v; I identify … | |
I'm writing a program that searches for particular sequences of bytes in a USB stick. The problem is that I don't know how to search effectively. ReadFile() allows me to buffer 512 bytes each time. If my sequence is fully present in that block, then there is no problem. But … | |
#include <iostream> #include<string> using namespace std; int main() { string admin_pwd="testing"; string encrypted ; string unencrypted; char key[5] = "abcd"; for (int x=0; x < admin_pwd.size(); x++){ encrypted += admin_pwd[x] ^ key[x/100%30]; } cout << "Encrypted = " << encrypted<<endl; for (int x = 0; x < admin_pwd.size(); x++){ unencrypted … | |
Im pretty new to coding in C++ and Im a student at devry unversity. I have to sort this class by credit hours in ascending order and Im having some trouble. If anyone could help it would be greatly appreciated. #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace … | |
So... I'm looking into learning Assembly. I downloaded the FASM assembler and I want to know how useful is assembly? I want the opinion from Cpp programmers because assembly programmers always tell me it's the best language -__- Also quick question: How do I know which register to put stuff … | |
I'm doing a project that require the user to type in the phonetic sounds for example, "th". then the program will play a wave file that produce th sounds. As there are many different wave files for a phonetic sounds, i decided to group them into separate files, which means … | |
Hey guys, I created a Student class in a header file and it works just fine. The problem is I'm trying to store the Student objects into a map in main which made the compiler generate a "in file included from ..." error. I'm having trouble fixing this problem as … | |
Alright, I need a program that has both a selection structure and a repetition structure. Would someone please tell me if I am doing this right. My code gives me the correct output but do I have a selection and repetition structure? #include <iostream> using namespace std; int main () … | |
In C++ you have this: std::string = "Name"; You can also read file with it, unlike reading the contents into a char[] with a limited amount of memory. So whats is C equivalent of a C++ string? | |
I am trying to figure out how to create a C++ program that has a Subtotal and a Grandtotal. Could someone please help start a program? It has to have a selection and repetition structure in it. | |
From what I've heard to be able to play two or more sounds at the same time, the sounds must be loaded in to multiple threads.On the documentation for PlaySound() I haven't seen anything about this, can some one tell me how to do that. | |
Hello, Over the past couple of days, I've been struggling with getting collision detection to work for my game, a 2D sidescrolling platformer, made with SFML 2. This is example code using my most recent method of collision detection, although it has some flaws: // main.h #ifndef MAIN_H #define MAIN_H … | |
Hello! After I compile and run my program a windows error message shows up, it doesn't give some specific information it's just a standard windows xp error that asks me to send report. It gives me the error because in my code I have some basic math like this: int … | |
Hello All! I am a little confused about the memory allocated for an executable. Now, say for example, this is my code: int foo = 1; int main() { const char* bar = "hello world"; int num; return 0; } Now, the "hello world" part would be stored in the … | |
How can I get SetConsoleTextAttribute to work with my Console? I tried everything. First I redirected the cout and cin buffers so that my console can have input and output. But now it doesn't have Colour :S I used: HANDLE OutputHandle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(OutputHandle, 10); I don't think GetStdHandle is … | |
What would be the possible reason why my code display two reasults whenever i search for a record that is in the second row or higher, first it display the first records and then it display the record i am searching. example output: ->Enter ISBN : A200 then the output … | |
Hello, I want to convert a WORD type to a string, I have this code: FileTimeToSystemTime(&fdFile.ftLastWriteTime, &SysTime); String numday = SysTime.wDay; But i says that operation connot be done because it's a WORD what I wan to insert to a String. And my question is, is there any function/way to … | |
How can I create PNG Files from an array of bytes or read a PNG file to create an array of bytes? I looked up the format but it looks nothing like a bitmap and I read the GDI doesn't support PNG's. So how does LibPNG do it then? I … |
The End.