49,756 Topics

Member Avatar for
Member Avatar for Efficience

Hello Everyone , I've this strange problem with using char pointer in my c++ programme with the gcc compiler (version 3.4.2). [code] char a='A'; char *c=&a; printf("%p %c\n",c,*c); std::cout<<c<<" "<<*c<<std::endl; [/code] I expect the output of printf and cout to be same but why am I getting strange output like …

Member Avatar for Efficience
0
547
Member Avatar for climberboy

I just wandered if there is a way to constantly update the time once it has been displayed on a console application. I am using the following code to display the time: [CODE]time_t rawtime; struct tm * timeinfo; time ( &rawtime ); timeinfo = localtime ( &rawtime ); printf ("The …

Member Avatar for Ancient Dragon
0
211
Member Avatar for awadojag

I'm working with a program where the user adds a few names together with the age. After this the program will write out the content of the text file. I'm having problems seperating the names and age into different variables. I want the program to put word nr1 in char …

Member Avatar for mayyubiradar
0
157
Member Avatar for naz arif

this is the code i have written so far....its in c++....i need ur help....i can't find errors...:( class Matrix { private: int rows; int cols; float *pData; public: int getrows(){return rows;} int getcols(){return cols;} void setrows(){rows=r;} void setcols(){cols=c;} private: void doCreate(); void doAdd(Matrix m); void doSub(Matrix m); void doTranspose(); void …

Member Avatar for naz arif
0
83
Member Avatar for patito

hi to all, can anyone help me writing a program that can set a pin of the serial com1 port at 12v+? it must be simple command line based,for example, program.exe -on or -off. any pin will work. thanks in advance :)

Member Avatar for RVNJIK
0
731
Member Avatar for Hatem Faheem

Hello everybody, I'm hatem faheem a student in Cairo university , Faculty of Engineering , Computer departement I have a question in the C++ string class constructor <string> that's the code [CODE] #include <iostream> #include <string> using namespace std; int main() { string s0 ("Initial"); string s1 (s0,3); string s2 …

Member Avatar for Hatem Faheem
0
104
Member Avatar for askhari139

can we put the restriction on some function of the loop variable in the loop conditions like the for loop in the following program #include<iostream> using namespace std; int main() { int a,size=2,b[size],i; cin>>a; b[0]=1; b[1]=1; cout<<"The fabbonacci sequence is:"<<b[0]<<" "<<b[1]<<" "; for(i=2;b[i]<=a;i++) { b[i]=b[i-1]+b[i-2]; size++; cout<<b[i]<<" "; } system("pause"); …

Member Avatar for Fbody
0
118
Member Avatar for Finarfin34

Hey guys! I wrote a program in c++ when I want to run it it says unable to start program 'c:\users\pc\documents\visual studio 2008\projects\proje1\debug\projem.exe system cant find specified path. But I checked and there is this path and files. What could be the reason? Thanks in advance!

Member Avatar for Rishikeshan
0
87
Member Avatar for sundip
Member Avatar for DGeneral

Hello, I want to write a program that reads a text file, which contains a table of data where the columns are separated by spaces, and store each column in different arrays with different data types. For example, let's say I have the following data: 1 hello 1.5 2 world …

Member Avatar for Fbody
0
9K
Member Avatar for aviavyne

Hello, I recently started taking classes in c++, and one of our assignments is to create a program that converts Fahrenheit to Celsius degrees. I was able to do so, however I want to make the conversion part into a subprogram, I have some idea on how to write it, …

Member Avatar for spirit of love
0
1K
Member Avatar for djhog

Need to sort an array of objects of type PhoneEntry, using PhoneEntry's greaterAlpha to do your comparisons. I have the sort function, but I'm not sure how to get everything working together. [CODE] #include <iostream> #include <string> using namespace std; class PhoneNumber { private: int area; int prefix; int suffix; …

Member Avatar for Ancient Dragon
0
106
Member Avatar for Kosithc

Hello, I am using this piece of code for allocating 3D array in memory by my dimensions HEIGHT, WIDTH, DEPTH which are variables. [CODE]p2DArray = new double**[HEIGHT]; for (int i = 0; i < HEIGHT; ++i) { p2DArray[i] = new double*[WIDTH]; for (int j = 0; j < WIDTH; ++j) …

Member Avatar for Ancient Dragon
0
200
Member Avatar for afizaex

This Array topic I had many problem, someone help me? Thank you! [IMG]http://i291.photobucket.com/albums/ll311/afizaex/Awam/IMAG0001.jpg[/IMG] [IMG]http://i291.photobucket.com/albums/ll311/afizaex/Awam/IMAG0002.jpg[/IMG] [IMG]http://i291.photobucket.com/albums/ll311/afizaex/Awam/IMAG0004.jpg[/IMG]

Member Avatar for afizaex
0
131
Member Avatar for mitrious

The execise in the books asks this: Design and implement a program to produce a permuted index. A permuted index is one in which each phrase is indexed by every word in the phrase. And says: A good algorithm is suggested in The AWK Programming Language by Aho, Kernighan, and …

0
66
Member Avatar for MothershipQ

I have a 200 point program to write for school that says how much extra grain will be left in the silo and Tomorrow is the last day to turn it in. But something is wrong with my while loop. Could you help me out? Also, I'm writing this code …

Member Avatar for gerard4143
0
132
Member Avatar for Newtype

Write a short program that takes an integer value (call it n) from the user and prints out a triangle composed of O and X characters. For example, if the user enters 3 as the input, your program should print out: O OX O X O If the user enters …

Member Avatar for Newtype
0
166
Member Avatar for need

Hello, The program finds the shortest path between the user inputted nodes. The nodes are integer. Now I need to modify my code to find the path between nodes which are string. Path between A and B instead of 1 and 2. Please help me to convert my code. [code=c++] …

0
71
Member Avatar for DanielWuVB

can somebody tell me which book for beginner in C++ .... I have some background in VB6 in old time ... Thanks !

Member Avatar for DanielWuVB
0
127
Member Avatar for Meleeruler

Alright, here's a problem I can't seem to figure out. I'm very new at all this, so hopefully this problem isn't too ridiculous. Basically the gist of it is in a program I made for a class; it wouldn't let the input for the cin.getline be typed unless I put …

Member Avatar for Meleeruler
0
255
Member Avatar for TinhornAdeniyi

[CODE][/CODE]ok this code has a few quirks that is annoying me the only part that does not straight up work is the Add a show i have a problem in increasing the size of the array. there is also the issue of couting two zeros for the minutes of the …

0
79
Member Avatar for newbiecoder

I took these codes from Deitel's book directly, I tried them at both Linux gcc and Codeblocks on Windows and they both gave errors. Can you tell me why I am getting these errors? Am I doing a mistake by compiling them? Here is the code: new.cpp: [CODE] #include <iostream> …

Member Avatar for newbiecoder
0
158
Member Avatar for it-lady

Analysis of algorithms is a form of mathematics. Consider the following problem: • We assume that a pair of squirrels has a pair of children every year. • These children are too young to have children of their own until two years later. • Squirrels never die. (The last assumption …

Member Avatar for it-lady
-1
99
Member Avatar for gisek

Hi, I'm trying to create a multiplayer game and I'm wondering if it will be useful to use threads and also how to use them. There would be the following actions in the game (on linux server): 1) server checking if clients are still connected 2) collision detection 3) processing …

Member Avatar for Ancient Dragon
0
148
Member Avatar for fukki

Hello ! I have array of struct and i want 1] when i run the program to load the data from it. 2] when i make changes to be saved in the text file the same time or when i quit the program I tried to put data in txt …

Member Avatar for Nick Evan
0
2K
Member Avatar for fukki

Hello ! I have array of struct and i want 1] when i run the program to load the data from it. 2] when i make changes to be saved in the text file the same time or when i quit the program I tried to put data in txt …

Member Avatar for Ancient Dragon
0
537
Member Avatar for kuchick32

I have a problem. I got my file to open but I don't know how to modify the file and have the output I need. Here is my code so far [code] #include <fstream> #include <iostream> #include <cstdlib> int main() { using namespace std; ifstream input; ofstream output; input.open("input.txt"); if …

Member Avatar for kuchick32
0
103
Member Avatar for fukki

I have read many topics regarding sort but i wasn`t able to sort them. I am new in C++. What changes i must do to sort the names alphabetically ? [code]#include "stdafx.h" #include <iostream> #include <string> using namespace std; class classroom { public: string studentName; void classroom::createStudent(string); }; void classroom::createStudent(string …

Member Avatar for fukki
0
142
Member Avatar for totalwar235

currently i am writing a text based RPG but, when i call for the fight my rand() either does not seed each time or it glitches to continuously gets the "Boar". if you could please take a look at it and see if the problem is in the coding, i …

Member Avatar for totalwar235
0
140
Member Avatar for usep

INPUT's: 1) Name 2) Current date (month, day, year) 3) Birthday (month, day, year) The output will be the person's age in years, months, and days. See example below: Input name: shane Input current date: Month (1-12): 9 Day (1-31): 25 Year (yyyy): 2010 Input birthday: Month (1-12): 9 Day …

Member Avatar for usep
0
126

The End.