49,761 Topics

Member Avatar for
Member Avatar for bubacke

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 …

Member Avatar for jonsca
0
54
Member Avatar for bubacke

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 …

Member Avatar for bubacke
0
191
Member Avatar for Valaraukar

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 …

Member Avatar for Valaraukar
0
198
Member Avatar for bbman

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; …

Member Avatar for jonsca
0
129
Member Avatar for dhruv_arora

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 …

Member Avatar for dhruv_arora
0
98
Member Avatar for memstick

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..

Member Avatar for memstick
0
120
Member Avatar for respondto

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

Member Avatar for NathanOliver
0
2K
Member Avatar for emcyroyale

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 …

Member Avatar for NathanOliver
0
198
Member Avatar for mybluehair

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 …

Member Avatar for Danny_501
0
130
Member Avatar for mybluehair

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.

Member Avatar for dohpaz42
0
78
Member Avatar for deez2183

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 …

Member Avatar for deez2183
0
465
Member Avatar for aj79

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 << …

Member Avatar for aj79
0
206
Member Avatar for RussianKös

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' …

Member Avatar for jonsca
0
226
Member Avatar for uhmyeah

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.

Member Avatar for nbaztec
0
163
Member Avatar for Kanoisa

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 …

Member Avatar for Bench
0
139
Member Avatar for Nexgr

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] …

Member Avatar for Nexgr
0
165
Member Avatar for angelrapunzel

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; …

Member Avatar for NathanOliver
0
108
Member Avatar for Tejas

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

Member Avatar for angelrapunzel
0
163
Member Avatar for CSherman

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 …

Member Avatar for Taywin
0
126
Member Avatar for vbx_wx

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) …

Member Avatar for nbaztec
0
265
Member Avatar for nbaztec

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 …

Member Avatar for nbaztec
1
141
Member Avatar for mebob

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 …

Member Avatar for thelamb
0
100
Member Avatar for jrw89

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 …

Member Avatar for jrw89
0
555
Member Avatar for invisi

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 == …

Member Avatar for invisi
0
188
Member Avatar for Thew

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 …

Member Avatar for Thew
0
242
Member Avatar for iamcreasy

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; …

Member Avatar for Bench
0
437
Member Avatar for DelilahDemented

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 …

Member Avatar for arkoenig
0
209
Member Avatar for Chosen13

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 …

Member Avatar for nbaztec
0
131
Member Avatar for Niner710

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 …

Member Avatar for nbaztec
0
2K
Member Avatar for vuki27

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 …

Member Avatar for mitrmkar
0
156

The End.