49,761 Topics
| |
hi all, i want to run a while (some condition holds) loop, and each time it is executed create a variable, a different one. my problem is: how do i get them to have different names, in particular, ongoing ones like "entry1", "entry2",... can i have like a counting integer … | |
hi, i want to have a vector of strings. i know i could declare it by [code] #include <iostream> #include <string> using namespace std; vector<string> vec; vec.push_back("this"); vec.push_back("is"); vec.push_back("my"); vec.push_back("array"); [/code] but thats very tedious. isnt there a more elegant way? if i had the vector as an argument to … | |
Ok, so I'm really after knowledge rather than a quick easy solution here. I am part of a team that is currently working on the development of a 'kind of' physics engine but I have hit a small wall since adapting the functionality of a class which was previously working … | |
Hey, I have an item class: [CODE] #pragma once using namespace System; using namespace System::Drawing; ref class Item { public: Item(void); int Type() { return _type; } void Type(int value) { _type = value; } String ^ Text() { return _text; } void Text(String ^ value) { _text = value; … | |
I created this function for my program : [CODE]int calcTotal() { petShop p; fstream f1; f1.open("Pet_Shop.dat",ios::app|ios::binary); int loc; loc=p.tellp(); float records; records=loc/sizeof(p); cout<<"Total number of records = "<<records; cout<<"Going back to main menu"; menu(); }[/CODE] I am getting this error : [CODE]error C2039: 'tellp' : is not a member of … | |
Hello! I am probably just going mad but. This code: [CODE]using namespace System.Windows.Forms;[/CODE] Generates the following error 1>GUItest.cpp(6): error C2143: syntax error : missing ';' before '.' 1>GUItest.cpp(6): error C2059: syntax error : '.' ..And I haven't the foggies why. Seems I cannot use .'s when declaring a namespace.. | |
how can i make the ide word wrap when i am writing lines of code, the code goes so far in width that I have to use the arrow button on my keyboard to see the end of line dev c++ 4.9.9.2 windows xp | |
Well I'm having quite a bit of errors with my code and have tried figuring out how to fix it, but I can't seem to figure out what is wrong. Here are the errors 1>------ Build started: Project: circle, Configuration: Debug Win32 ------ 1>Compiling... 1>circle.cpp 1>c:usersemcydocumentsvisual studio 2008projectscirclecirclecircle.cpp(38) : error … | |
I need to create a new txt file using ofstream, but I need to use a string to name the file. For example: [CODE] string string1 = "testfile.txt"; ofstream myfile; myfile.open (string1);[/CODE] but when I try, it says I can do this because string is not a valid variable type … | |
I am trying to say "if variable is NOT greater than or equal to, then do this" Here is how I tried to write it: [CODE]if(mouse_x !>= 300){ blah blah blah }[/CODE] But my complier doesn't like that. Does anyone know what I did wrong? Thanks. | |
Design and run a program that takes a numerical score and outputs a letter grade. Specific numerical scores and letter grades are listed below: 90-100 = Grade A 80-89 = Grade B 70-79 = Grade C 60-69 = Grade D 0-59 = Grade F In this program, create two void … | |
I am working in Microsoft Visual C++ 2008. Here is my sum of digits code: [CODE]#include <iostream> using namespace std; int main() { int num; int sum=0; cout << "Number, please? "; cin >> num; while (num>0) { sum=sum+num%10; num=(num-num%10)/10; } cout << "Sum of digits: " << sum << … | |
Hello. I'm very new at C++ world, so, I need some help. I'm building an Browser Called iNet, and, it gave me 4 errors: c:\users\sepultura\documents\visual studio 2008\projects\inet 0.1\inet 0.1\iNet.h(193) : error C2039: 'timer1_Tick' : is not a member of 'iNet01::iNet' c:\users\sepultura\documents\visual studio 2008\projects\inet 0.1\inet 0.1\iNet.h(22) : see declaration of 'iNet01::iNet' … | |
i am pretty new to c++ and dark gdk. im trying to make a simple platform game to start off. i have the basic controls down, the animations, and collision. but i am having much trouble finding how to create the effects of gravity. please help. | |
Hi everyone, I'm not so sure if this belongs in here or in computer science but I think as I want to use c++ this may be the place. I was wondering if anyone could point me towards some tutorials/references or books on methods for approaching the design of larger … | |
I am trying to implement the A* algorithm in C++ ([url]http://en.wikipedia.org/wiki/A*_search_algorithm[/url]). The pseudocode i am trying to implement is: [code]function A*(start,goal) closedset := the empty set // The set of nodes already evaluated. openset := set containing the initial node // The set of tentative nodes to be evaluated. g_score[start] … | |
hi frnds!! i have d code for series x^!+x^2+x^3+....x^m with single loop only //wap to find sum of series and print series also //x+x^2+x^3+......x^n #include<iostream.h> #include<conio.h> void main() { clrscr(); int n,x,count1; int sum=0; cout<<"enter a number"; cin>>x; cout<<"enter nth term till which u want to compute"; cin>>n; int count=1; … | |
Can smeone help me to write a prog. to find the sum of the following series: 1+(1+2)+(1+2+3)+....... n terms Regds. TEJAS | |
Hello all. I am working on this program and having some troubles with it. I have tried lots of different things and can't get it to do what I want. I guess I am not really understanding the code and how to word it properly. I am writing a program … | |
Hello. Can anyone help me how to implement the subscript ([]) operator for a STL list class ? [code] T& operator [] (int n) { } [/code] [code] template <typename T> class list { public: struct node { T data; node* prev; node* next; node(T t, node* p, node* n) … | |
Due to various posts asking for syntax highlighting, I decided to give it a shot & come up with a Syntax Highlighter for multiple languages. Also as many posters want to Copy it to Word, I added a functionality to directly export the highlighted code to MS-Word. Both the highlighting … | |
I have to make a program that takes 4 inputs and outputs the 2 largest inputs. So I wrote this code, [CODE] #include <iostream> using namespace std; void largest_two ( int input[4], int output[2] ) { bool restart; int i; int temp; do { restart = false; for ( i … | |
I've been trying to learn C++ for about a year now and came across [URL="http://openbookproject.net/thinkcs/cpp/english/chap04.htm"]this excellent tutorial[/URL]. I can't leave anything alone so I changed some single quotes to double quotes and have the following code:[CODE=C++]#include <iostream> void printTwice(char phil) { std::cout << phil << phil << std::endl; } int … | |
Below is the code I wrote, for taking the arrow key imput, just wanted to share it and get some feedback thanks :) [CODE]#include <iostream> #include <conio.h> using namespace std; int main() { int number = 0; int number2 = 0; while(true) { int arrow = getch(); if (arrow == … | |
| Hello everyone, I have a problem in my Borland C++ project. I need to use my own COM object written in C# (this COM allows me to directly print PDF files) in my another project in C++, but as soon as I call some COM functions which require a string … |
This code is supposed to get one int and one string.But after entering the int, the [B]getline[/B] line is acting weird...it dont prompt me for any string input, rather then it shows the same value as the int. [CODE]#include<iostream> #include<string> using namespace std; int main() { int teacherID; string teacherName; … | |
I'm trying to use a switch statement in my code but I'm having a bit of difficulty. I have an error message I do not understand and do not know how to fix. The message reads, "switch quantity not an integer". I'm new to C++ and would appreciate any help … | |
Well, this project I'm working on is a Pokedex Program for my little sister for her birthday. Anyways, I have a file PokeList.txt, which I want to store every Pokemon next to their ID number. The text file is: [code] 1. Bulbasaur 2. Ivysaur 3. Venusaur 4. Charmander 5. Charmeleon … | |
I have a function called read() that interacts with some hardware and sometimes it returns the value very quickly and other times it could be very slow. I would like to have a timeout associated with my function read() so that if it takes over maybe a second then the … | |
I have been using Borland Turbo C++ 3.0 to get started with C/C++. I am making a graphics application and this error has come up. I know that my code is too big but I cannot cut it down and I need to add more features. Can someone please tell … |
The End.