49,761 Topics

Member Avatar for
Member Avatar for marrkee

hello, I'm almost done it, but I'm lost in the huge forest of c++... so, here's my code: [CODE]#include <iostream> #include <fstream> #include <time.h> #include <stdio.h> using namespace std; int gettime() { time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); } int …

Member Avatar for marrkee
0
142
Member Avatar for Jsplinter

I have a nested class declared as: [CODE]class A { class B { // members }; // members }; [/CODE] Is there a good way to avoid typing A::B every time I need to access B's members? I'd just like to do this in one .cpp file. I tried "using …

Member Avatar for Jsplinter
0
223
Member Avatar for murnesty

[B]In main.cpp[/B] [CODE]#include <iostream> #include "init.h" using namespace std; Initialization Init; int main() { Init.test(); return 0; } [/CODE] [B]In init.cpp[/B] [CODE]#include <iostream> using namespace std; class Initialization { public: void test() { for(int i=0; i<10; i++) { cout<<i; } } };[/CODE] [B]In init.h[/B] [CODE]#ifndef INIT_H_ #define INIT_H_ class Initialization …

Member Avatar for murnesty
0
129
Member Avatar for ahp@aol.in

Hi, I've confusion with static member variable in c++ class. Please have a look on following code. class test { public: static int i; float j; }; int test::i = 0; int main() { test *t = new test; test::i = 100; cout << "test::i = " << test::i << …

Member Avatar for ahp@aol.in
0
414
Member Avatar for arun srinivaas

Hi Guys. I tried creating an insert into tree datastructure which is causing core dump. Please identify the issue... Here is the code [code] #include<iostream> #include<string> #include<stdlib.h> using namespace std; //Global Data struct Tree { Tree* right; Tree* left; int element; }; typedef struct Tree* TreeData; //Function Declaration void insert(TreeData …

Member Avatar for hag++
0
139
Member Avatar for SWEngineer

I noticed that the main.cpp in a Qt application has to contain the following line: QApplication app(argc, argv). I know that argc is the number of command-line arguments, and argv is that array list of command-line arguments. But, the question in my mind is: what are those arguments I'm passing …

Member Avatar for Caligulaminus
0
215
Member Avatar for geekme

While running all codes in visual c++ it gives me the same error -"Error 1 fatal error C1083: Cannot open include file: 'test.h': No such file or directory c:\users\ila\documents\visual studio 2008\projects\game\game\testgame.cpp 1 " I have created the header file test.h.

Member Avatar for hag++
0
73
Member Avatar for sing1006

[CODE]#include<iostream.h> int tripeCallByValue(int count1) void main(){ int count=2; cout<<"count is "<<count<<endl; cout<<"count1 is "<<count1; } int tripeCallByValue(int count1){ count1=count*3; return count1; }[/CODE] when i compile with compiler,i got a syntax error.but i didnt where i have did worng.

Member Avatar for Fbody
0
171
Member Avatar for pritpal.singh88

hi friends im facing one problem i have used cin to input a choice like (cin>>ch) then i have used to take input to string as getline(cin, string_s) but getline does not works when i use cin if i donot use cin it works well why it is happening??? and …

Member Avatar for Kanoisa
0
124
Member Avatar for Theisonews

i want to create a program that will have an arraycalled array1[] of 30 sets of 3 one digit numbers i.e 804, 450,430 etc) i will have 13 vector containersor arrays defined with a series of 3 one digit numbers. i want the program to find any series of numbers …

Member Avatar for Lerner
0
121
Member Avatar for newack

I havve database project to run. i have two tables with relationship. i want to show some filds of one table and some fields of other. When i run it, it throws exception and says "object reference not set to an instance of an object" what could be the problem?

Member Avatar for Narue
0
73
Member Avatar for jimJohnson

I am just about to finish my last C++ program and for the life of me cannot figure it out. My problem is everytime I try to run this my command prompt returns with "Write file cannot be opened". I have looked many times throughout my program and cannot figure …

Member Avatar for jimJohnson
0
145
Member Avatar for IndianaRonaldo

char* p=(char*)malloc(10); in the above state ment,has the memory been initialised??...what is the difference between allocatingg it and initialising it?? thanks in avdance...

Member Avatar for IndianaRonaldo
0
211
Member Avatar for sha11e

I have a c++ program that uses the rand function and the srand function. It worked fine when I compiled it on my windows machine, but I got errors when trying to compile it on ubuntu linux. After I included cstdlib the program worked fine on the linux too. 1. …

Member Avatar for Narue
0
296
Member Avatar for kabilah

I'm having an issue with a Hanoi Tower problem. I'm passing an index variable and a vector to the recursive function. The disc numbers are being displayed correctly, but the peg numbers are not. The output is only the moves not the disc numbers on each peg. Output should be …

Member Avatar for kabilah
0
1K
Member Avatar for mistereff

I want to be able to determine if there are less than 9 values of 'S' but it always returns a count larger than it should be. The array is board[7][7]. Edit: The cout for sheepCount is for debugging purposes. [CODE] int sheepCount; sheepCount = 0; for (int i = …

Member Avatar for sfuo
0
151
Member Avatar for pritpal.singh88

hi friends i want a delay of 100 milliseconds in my program as their is delay function in dos.h likewise i want to know [B]is there any function in c++ for delay of some milliseconds im using ubuntu.[/B]

Member Avatar for sergent
0
930
Member Avatar for butler273

So this is probably going to seem like an obviously simple question. I'm working on a basic project involving linked lists. I have a single link linked-list, within this linked list I have a pointer to an dynamically allocated Object I'd like to be printed, currently I keep getting rubbish …

Member Avatar for mitrmkar
0
198
Member Avatar for munitjsr2

[CODE] #include <iostream> #include <cstring> using namespace std; class CD { public : void getCDdetails(CD *); void printCDD(CD *) const; int putCount() const { return count; } private : static int count; char Title[60]; char Artist[60]; char Type; int Tracks; }; int CD :: count=0; void CD :: getCDdetails(CD * …

Member Avatar for munitjsr2
0
158
Member Avatar for template<>

Hello Community, I am trying to figure a simple way approximate cost of context switching for a given OS/hardware combination under different loads. For example on my 2 GHz dual core MAC OSX, running single instance clocks at 0.5 usec where as three instance at 1.3 usec. Below is sample, …

Member Avatar for template<>
0
379
Member Avatar for AODfan

I am having a problem where the colsum[column] is just displaying junk data on the output, and I cannot seem to figure out why, if I put an output statement in the Computesums function for it outputs fine(just not the right place, this is fine, I was doing that for …

Member Avatar for AODfan
0
160
Member Avatar for raigs

[CODE]myuser@linux:~/Desktop$ gcc -nostdlib -Wl,-dynamic-linker,/home/myuser/Desktop/ld-linux-x86-64.so.2,-rpath,/home/myuser/Desktop libc.so.6 libgcc_s.so.1 simple.c myuser@linux:~/Desktop$ ldd a.out linux-vdso.so.1 => (0x00007fffbf5ff000) libc.so.6 => /home/myuser/Desktop/libc.so.6 (0x00007f308b7ae000) libgcc_s.so.1 => /home/myuser/Desktop/libgcc_s.so.1 (0x00007f308b598000) /home/myuser/Desktop/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f308bb11000) myuser@linux:~/Desktop$ [/CODE] Which ld is being used, the one on the Desktop or the one in /lib64 ? What options do I have to use …

0
108
Member Avatar for newbie14

Dear All, I have a code as below. First I call the readFile in here I can read the value into the name variable which I have declared as string. The problem now as I run the loop I want to put each of the name into an array of …

Member Avatar for newbie14
0
293
Member Avatar for rkcastillo

I'm developing a program that will search through a Google Search Term and add that website to a spreadsheet. Does anyone know an algorithm to look at that website and find the contact email?

Member Avatar for TrustyTony
0
65
Member Avatar for yakovm

I want to implemet linked list in c++ ,while adding new node I dynamicly allocate it, if some allocation fails I would like my program to stop the execution. After the "new Node" fails the exception is thrown so do I have to call the destructor explicitly in the exception …

Member Avatar for Narue
0
66
Member Avatar for sergent

I have several questions regarding OS programming. 1 - How do they write Operating systems? 2 - Do you know what compilers is used to do that (or library)? 3 - Do they have to burn it to a CD and reboot the computer every time they test it? 4 …

Member Avatar for sergent
0
173
Member Avatar for chess2009

[CODE] Str Str:: operator+(const Str & append) const { unsigned i,j; for(i=0,j=0 ; i<append.used; i++ ,j++) temp[i]=append.data[j]; for(j=0 ; i<used; i++, j++) temp[i]=data[j]; temp[i]='\0'; } [/CODE] used and append.used are the length of strigs. and data is pointer to array. Hi I am trying to concatenate two strings in the …

Member Avatar for jonsca
0
113
Member Avatar for asadaziz

what i wanted to do was to read multiple .doc(files) and apply an algo on it, now .doc files can be read with stream reader the problem here is how to read multiple files in a folder and the names of the files are also not known please help

Member Avatar for asadaziz
0
374
Member Avatar for apanimesh061

[CODE] //clrscr.h #pragma once #include <windows.h> #include <iostream> #include <conio.h> using namespace std; void clrscr() { COORD coordScreen = { 0, 0 }; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y; FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); GetConsoleScreenBufferInfo(hConsole, &csbi); FillConsoleOutputAttribute(hConsole, csbi.wAttributes, …

Member Avatar for apanimesh061
0
158
Member Avatar for king03

Please help me out guys I can't fully understand how this code works but I know some about it and I'm also unsure of such things about how it operates. [CODE]#include<iostream.h> #include<conio.h> int main() { for(int i=1; i<=6; i++) { for(int f=1; f<=i; f++) cout<<"*"; cout<<endl; } system ("pause"); return …

Member Avatar for Fbody
0
2K

The End.