51,592 Topics
![]() | |
struct pieces { string ap, bp, cp, dp, ep, fp, gp, hp, ip, jp, lr, rr, lk, rk, lb, rb, q, k; } b, w; Code 1>c:\users\will\documents\visual studio 2010\projects\chess\chess\pieces.h(3): error C2146: syntax error : missing ';' before identifier 'ap' 1>c:\users\will\documents\visual studio 2010\projects\chess\chess\pieces.h(3): error C4430: missing type specifier - int assumed. … | |
I'm trying to understand recursion and stack overflows. First, why does this not cause a stack overflow? Is it because the function returns every time and that the stack isn't populated upon each call? void Meh() { } int main() { while (true) Meh(); } Two, What is the difference … | |
erm i learn new thing, its a bad idea to use "using directive" inside a class declaration, because this can leads to ambiguous functions/statements inside the main program. using namespace std; the question is, is it okay to use "using declaration" inside a class declaration? such as : using std::cout; … | |
I need to use forms, widgets etc. in my program which already takes care of creating a window and such. So the question is, would it be okay to use Windows lib to add the needed features, such as a form with a few widgets without any errors, memory leaks … | |
The code below gives me a Narrowing conversion from int to uint32_t: typedef union RGB { uint32_t Color; struct { unsigned char B, G, R, A; }; } *PRGB; inline RGB Rgb(int R, int G, int B) {RGB Result = {((R & 255) << 16) | ((G & 255) << … | |
// The Physics Game.cpp : Defines the entry point for the console application. //Rodney Jenkins #include "stdafx.h" #include <iostream> #include <cstdlib> #include <ctime> #include <cmath> using namespace std; double eqOne_vf(double Vi , double a , double t) { return ( Vi + (a * t) ); } double eqTwo_x(double Vf … | |
Hi, Im new to SDL, when i compile this example program i got these linker errors first defined here .drectve `/manifestdependency:"type='win32' name='Microsoft.VC90.CRT' version='9.0.21022.8' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized [Linker error] undefined reference to `__security_cookie' [Linker error] undefined reference to `_alloca_probe_16' [Linker error] undefined reference to `@__security_check_cookie@4' [Linker error] undefined … | |
hi all this is the code in question namespace std { typedef std::basic_string<wchar_t> wstring; }; #endif #if defined(__HAIKU__) namespace std { class wstring : public std::basic_string<char> { public: wstring(const char *t) : std::basic_string<char>(t) { } wstring() { } wstring(const wstring &that) : std::basic_string<char>(that.c_str()) { } wstring(const std::basic_string<char> &that) : std::basic_string<char>(that) … | |
Hi, I just to know what code should I use to terminate the program when the user input the character n. Here is the code I have so far | |
To be specific I'm trying to implement this into a small game. What I'm thinking of is having a base/default class for derived objects such as player, enemies, tiles and so on and later the derived classes would inherit this base class and add whatever is needed depending on the … | |
Hello All! I was just wondering if C++ classes could internally be represented in the following way: #include <stdio.h> struct A { int a; void (*ptr) (A *); }; void display(A *ptr) { ptr->a = 2; printf("ptr->a = %d", ptr->a); } int main() { A obj; obj.ptr = display; obj.ptr(&obj); … | |
Hello everybody, I'm in need of a bit of help here. I got this C# snippet: public static byte[] StringToByteArray(String hex) { int NumberChars = hex.Length; byte[] bytes = new byte[NumberChars / 2]; for (int i = 0; i < NumberChars; i += 2) bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), … | |
excuse me but can someone teach me how to get a string with space example : this author i need to get the codes on how to get that thank you | |
hi, i read in ebook about overleaded iostream operator for class, but im a bit confused about this one : ostream &operator << (ostream &strm, const FeetInches &obj) { strm << obj.feet << " feet, " << obj.inches << " inches"; return strm; } > Notice the function has two … | |
I currently have a running program. All i want to do is be able to shut it down at anypoint by pressing CTRL C. I cannot figure out the code for this command for the life of me. Can someone please help me out? thank you. I am using c++ … | |
**Dudearoo** *Useing Code::Blocks* Hey you guys. ive got a problem, ive got a simple while loop being executed that loops 41 lines of code untill the user types no for example int repeat = 2; while (repeat == 2) { // my code // || Example Code // \/ cout … | |
Good Afternoon, I'm new to C++ programming and I have to do a program that deals with strings. Below is the code that I have so far, I have problems in this section of the program Get three lines from the keyboards. Play with string copying, concatenation, and input size … | |
Hi I need the answers one of my two questions which were asked by our teacher in class room. Q1. Languagess are system software or application software? Q2. In which software the languages are written? for example in which software the c++ language is written? plz give your answer with … | |
hi everyone I am having a little problem with the program below. If I input "2/5 * 2/6" the char "/6" will be stored, so when I try to multiply by a simple variable by entering "3/7 * 6" the program will read "3/7 * 6/6". is there a way … | |
I want a fast algorithm to calculate no of permutations for n elements with some elements identical. Using formula : n! / k1! k2!....km! where ki = no of i elements, i = (1,2,...m) and k1 + k2 + ...... + km = n **Without calculating each factorial** as if … | |
Why dont we use '&' in the case of strings in function scanf ?? e.g. :- scanf("%s",date); here date is a character arraymeans string. Plz help | |
Hi, I only know C++ as a medium level programmer, not a real beginner but absolutely no veteran, I need to learn so much more C++ stuff. I can fairly program small programs in C++ and i really like C++. I also started using some of the new cool C++11 … | |
I need to extract pitch, dynamics (loudness or softness), tone color, and duration of an audio file. This is regarding some research work I am doing. How should I start ? Provide me with some links if possible! Is C++ a good option for this? Or should I try some … | |
Here's my code in which i am getting SIGABRT for 7 test cases :- #include<cstdio> #include <queue> #include <vector> using namespace std; int main() { //variable declarations int i,j,steps=1,n,m,s,t,tmp,tmp1,visited[1000001]; vector<vector<int> > buildings ( 3501, vector<int> ( 3501 ) ); queue<int> tovisit; //take inputs scanf("%d %d",&n,&m); for (i=1;i<=m;i++) { scanf("%d %d",&tmp,&tmp1); … | |
i'm using Dev-cpp. i tried my best to find out the reason but could not so please help me out | |
Hello everyone ! I want to get output in C++ in same line. The following code gives me output in separate line. for(int i=0; i<=10; i++) { cout << i <<" " <<endl; } | |
am having a problem in incrementing the number automically into the database every the when save. The initial number i want it to be 001 in a text box and when i save it, it should increment into 002 and so on. And every time i load the web page … | |
This is probably a silly question but i really don't know the answer to it. Can you write a program in C++ and have another part written in C and compile them into a single executable file? I'm thinking a c/c++ compiler like visual c++ would do this.. Is that … | |
Can anyone check my memory class and suggest changes or things I may need? I'm writing it so that I don't have to worry about deleting anything everytime I allocate. #include <iostream> template<typename T> class Memory { private: size_t size; T* data; public: explicit Memory(size_t Size) : size(Size), data(new T[Size]){} … | |
Good Afternoon, This is my first class in C++ and I'm having problems with a program that needs to print a calendar of June, July and August 2008 into the output file "outCalendar.txt" . I should format the result for month well so that it looks like a real calendar … | |
This program does not crash but behaves badly due to not allocating enough space for vector z in line 21. If I comment out line 21 and instead uncomment line 23, things work well. If I comment out both lines 21 and 23, the program will crash, presumably because I … | |
I have a program where am trying to access a dataset in the main form from a 2nd Winfrom. I have created a form 1 ref but when I use this to access the datatable in the dataset it doesnt seem to work. The following code is for Form 2 … | |
What's a fast way to fill a union/struct of integral members with ALL Zeroes? RECORD* UNION = {0}; void ZeroStruct(int X, int Y) { UNION = new RECORD[X * Y]; int K = 0; for (int I = 0; I < X; I++) for (int J = 0; J < … | |
Is it possible to overload one operator more than once? I have a struct that is just my idea of a C++ Box. I'm trying to increase the size of a box using an integer or another box. I'm trying to do: Box X(0, 0, 0, 0); Box Y(1, 1, … | |
I am currently working on kind of multi-graph structure. The thing is that two graphs are needed for my application which span the same vertices but with two distinct set of edges (i.e., a multi-graph). The first graph is a binary search tree, while the second graph must be general … | |
Hey, I am trying to make a C++ scrit that decodes and encodes tenis polar (search it on Google if you don't know what it is). After some testing, I found out my application stops after the strcpy. Any help? The code is below. Thanks! #include <iostream> #include <cstring> #include … | |
Hey all, I usuallly don't like asking for help on these sites but I have been kicking myself for a while now implementing boost regex for a program (i have never had any prior issues). I believe the issue is with my regex syntax but i have tried numerous variations … | |
I have a union defined as so: typedef union RGB { unsigned Color; struct { unsigned char B, G, R, A; }; } *PRGB; I'm reading 32 bit and 24 bit bitmaps. I'm trying to Read Pixels from my RGB union and set pixels as well. I know bitmaps are … | |
The following is my code for Edit Distance problem. The problem asks us to find the edit distance between two strings. My code, I think gives the correct output. If I run the code with two strings of 1500 length each, I get the error. But if I run it … | |
I have a problem. 1>------ Build started: Project: SDL Test, Configuration: Debug Win32 ------ 1> playa.cpp 1> main.cpp 1> Generating Code... 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(43): warning C4715: 'load_image' : not all control paths return a value 1>c:\users\will\documents\visual studio 2010\projects\sdl test\sdl test\main.cpp(43): warning C4715: 'load_image' : not all control paths … | |
So I was trying out SDL_gfx lib and tryed using the rotozoomSurface() [Click Here](http://www.ferzkopp.net/Software/SDL_gfx-2.0/Docs/html/_s_d_l__rotozoom_8h.html#a3cb0c11d5edc929579c807dc7612348c) which should've rotated my surface at runtime, but it seems that whenever I do that my surface turns invisible. It doesn't matter if I predefine the rotation or use it at runtime, the same happens, I've … | |
I'm very new to C++; can a program be started with anything other than `int main`? And what, exactly, is the purpose of the `main` part, anyway? | |
![]() | #include "stdafx.h" #include <iostream> using namespace std; int main () { int a, b, c; cout << "š"; cin >> a; cout << "Č"; cin >> b; c = a+ b; cout << "Ć" << c << endl; return 0; } So i tried using characters from my own language … ![]() |
hello everyone..i've vs2010 in my system..and i'm trying to build a simple web browser using webkit..could anyone please tell me what do i need to install to be able to work on vs2010?? and a simple demo code about how to use the webkit sdk..i've searched a lot on google..but … | |
I'm using VC++ 2010 with Windows 7 x64. I'm compiling all my code as C code. I have a for loop like this: for (i = 0; i < max; i++) { ... } But when I run it, `i` is being set to `max` If I set `i` to … | |
#include <iostream> #include <cmath> #include <iomanip> using namespace std; int main() { float annualIntRate, principle, monthlyPayment, monthlyIntRate, totalAmt, intPaid; int yearsBorrowed, numPayments; cout << "This program computes information associated with a loan" << endl; cout << "Please input the Annual Interest Rate:" << endl; cin >> annualIntRate; cout << "Pleast … | |
Dr Mirna always gives True/False tests to her class. Her tests have always 10 questions. The maximum class size is 5. She needs a program that will calculate the students’ grades based on the best grade. Grade A will range from the best score, to the best score minus 2. … | |
So i wanted to write a Hangman game and i started it, as im newbie programmer it took me several days to track all the bugs etc. Meanwhile i want to get good habits on designing and i read that Getters and Setters arent the best way to go for … | |
In C#, what methods take the place of the old kbhit and getch functions in C? (I'm writing a console application in Visual Studio.) | |
Hi -i've started using netbeans and compiling in it recently and I'm not sure what the problem is here. Not sure if it isn't reading the Element.cpp/.h files while building/running the main.cpp In my main: Element a, b(5); cout<<(5+b)<< endl; Then in the .h: Element operator+(const Element&obj); And in the … |
The End.