49,761 Topics

Member Avatar for
Member Avatar for dsuh06

what does the following do? int array[6] = { 5, 3, 4, 17, 22, 19 }; int* ptr = array[0] *ptr = -1; thank you!

Member Avatar for Ancient Dragon
0
113
Member Avatar for ricnyx

[code]#include <iostream> #include <fstream> #include <cstdlib> using namespace std; int main( ) { ifstream fin; ofstream fout; fin.open("income.dat"); fout.open("total.dat"); char income; fin.get(income); while (! fin.eof()) { cout << income ; fin1.get (income) ; } double next, sum = 0; int count = 0; while (fin >> next ) { sum …

Member Avatar for Lerner
-1
108
Member Avatar for brlukosk

Hi there, I am currently working on a program that reads an inventory list from a file, sorts the list, and then determines the value of the inventory based on the price and the quantity on hand. After these calculations I need the program to write the output to a …

Member Avatar for Lerner
0
1K
Member Avatar for d0ugg

Hi all, I have a little question, my compiler is giving me the following error: error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator <<(std::basic_ostream<_Elem,_Traits> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_ostream<_Elem,_Traits> &' from 'std::istream' see declaration of 'std::operator <<' Here is the main part of my project. [CODE] #include <iostream> …

Member Avatar for Ancient Dragon
0
124
Member Avatar for superbob

hey guys, i have a problem with this program... [CODE] void findMax(int arr[], int n, int* pToMax) { if (n <= 0) return; // no items, no maximum! int max = arr[0]; pToMax = &arr[0]; for (int i = 1; i < n; i++) { if (arr[i] > max) { …

Member Avatar for Ancient Dragon
0
82
Member Avatar for DREAMER546

hey .. please i need help with this code when i write it and i start in case 3 .. i've error massage .. illegal case .. why is that ? [CODE][LIST=1] [*]#include <iostream> [*]#include <string> [*]using namespace std ; [*]class employee [*]{ [*]private: [*] string name; [*] int salary; …

Member Avatar for DREAMER546
0
80
Member Avatar for johnnyjohn20

Hi, I have an array with elements filled with values such as 36.0119. I am trying to find a way of rounding each value to the nearest whole number E.G. 36. To show i have attempted this i have used cout with the array and set precision which is ok …

Member Avatar for WaltP
0
965
Member Avatar for tootypegs

Hi, i would like to be able to create an icon that appears in the tray by the clock in the bottom left of the desktop. I've looked around and found a little help on msdn but im struggling to understand everything on it, i have the following code (from …

Member Avatar for Ancient Dragon
0
95
Member Avatar for johny112

Im getting 2 of these warning message upon compiling the programme below. Cant figure out why. can someone help please? warning C4700: local variable 'rate_of_pay' used without having been initialized warning C4700: local variable 'hours' used without having been initialized Question Develop a C++ program that uses a while structure …

Member Avatar for Ancient Dragon
0
84
Member Avatar for tones1986

Hey folks. I am working on a program (really its 2, but they go hand in hand). The first one takes a text file which contains the following: last name first name SSN Salary Years employed There are 7 entries in the text file to be read in... The program …

Member Avatar for vmanes
0
157
Member Avatar for guitarrick

How many bools can I connect?? e.g. if((x>j) || (y<t) || (m=c) && (x != 0)) Please pardon any improper syntax, and any guidance is greatly appreciated (My text doesn't go into great detail with bools, but we're working with classes right now, and in one example there are three …

Member Avatar for guitarrick
0
356
Member Avatar for ricnyx

#include <iostream> #include <fstream> using namespace std; int main( ) { ifstream fin; ofstream fout; fin.open("income.dat"); if (fin.fail( )) { cout << "Input file opening failed.\n"; exit(1); } fout.open("total.dat"); if (fout.fail( )) { cout << "Output file opening failed.\n"; exit(1); } double next, sum = 0; int count = 0; …

Member Avatar for ricnyx
0
130
Member Avatar for Chaster

Hi everyone, I created a quite complex model in 3d studio max, then I converted it to an .obj file. In 3dsm I put the textures, everything looks fine. Then, when I load the object file it's gray again. I tried the following: - read the texture file (BMP) - …

0
60
Member Avatar for johny112

Im trying to write the programme for the following question, and im really struggliing. I will be reaaly thankful if someone can give me some tips or a programme for this. I would also like to point that im new to programming and this website so please give me some …

Member Avatar for johny112
0
101
Member Avatar for misdongard

hey ppl.. can someone please help? I am aware that u said u have to attempt the question urself but my teacher is an asshole and doesnt know how to teach very well. and he dropped a big question on us and none of us know how to do it, …

Member Avatar for Lerner
0
77
Member Avatar for java.cream

Hi all, [CODE]1: #include <iostream.h> 2: 3: int main() 4: { 5: cout << "Hello World!" << endl; 6: return 0; 7: }[/CODE] In the above code does the line 6 (return 0), required by the operating system,that means tells the operating system a program finish? If true, what the …

Member Avatar for Ancient Dragon
0
105
Member Avatar for nicz888

[code=c++] #include <cstdlib> #include <ctime> #include <iostream> using namespace std; // prototype and name space declaration bool testAnswer(int, int, int); void correctOutput(); void incorrectOutput(); bool mathTest(); //------------------------------------------------------------------ //------------------------------------------------------------------ //------------------------------------------------------------------ int main() { if (mathTest()) { !(mathTest()); mathTest(); } } bool mathTest() //main function { srand((unsigned)time(0)); // random number generator int …

Member Avatar for Ancient Dragon
0
127
Member Avatar for tonyaim83

Hi I m using the boost graphml.cpp file to extract information from a graphml file. But when trying to compile this i m getting compilation error `C:\boost_1_34_1\libs\graph\src\graphml.cpp expected } at end of input` What can be the reason for this. I checked it out the all combination of braces are …

Member Avatar for tonyaim83
-1
164
Member Avatar for rajsharma_85

hi guys, I am making a program in which I have to enter start date and time and stop date and time in format like 01:05:07 15:26:57 I know that i need to use <time.h> function for that but i don't know how can i calculate the difference between time. …

Member Avatar for Salem
0
141
Member Avatar for edek

Hi all! I need to create regex that matches everything before some specified (whole) word. Lets say I need everything before 'have' in such text: What ^7^*#/> I @@3->;: have to do with this *~~@}}], hmm...? ...so I would like to have "What ^7^*#/> I @@3->;: " as a result …

Member Avatar for edek
0
88
Member Avatar for ubc123

Excellent resource for C/C++/C#, java, JavaScript DHTML, C / ANSI-C、 SQL / MySQL it contains thousands of examples, downloadable source codes and tutorial... Please have a look。

0
53
Member Avatar for rodce

I'm a beginning C++ student/programmer, and I'm having a difficult time coming up with an algorithm to solve a programming problem. If someone could give me a recipe on how to go about solving the following problem using c++, I would appreciate it. Problem: A school has 100 lockers and …

Member Avatar for WaltP
0
670
Member Avatar for matt611

I need to read a file one word at a time. When I read the word it needs to be stored in a char* so I can pass it into my hash function. Whenever I try getline or infile>> my program just crashes. could someone please tell me what I …

Member Avatar for ravenous
0
117
Member Avatar for DREAMER546

hey .. please i need tutorial 4 vector .. because i'm tring to convert this code from array to vector .. but i failed .. so i think my way is wrong .. :( [CODE=c++]#include<iostream> using namespace std; #include<string> #include<vector> class student_recored{ vector<int> ex; string name; long ID; public: void …

Member Avatar for DREAMER546
0
99
Member Avatar for drvd80

Hello Peers, I have a sequence of data files (Site_1.txt, Site_2.txt,.....,Site_N.txt) that i need to read into my main program. Although I managed to construct the file names (as character arrays using sprintf), I am not sure of how to pass them to the ifstream, as it needs the file …

Member Avatar for Duoas
0
2K
Member Avatar for Duki

Ok, I'm going post all of my code, and hopefully someone can tell me where my error is at. I'm guessing I need to do a cin.ignore() somewhere, but I'm not sure where. I've tried it in a couple of places, but nothing has fixed the problem completely. [code=c++]#include <string> …

Member Avatar for jbennet
0
237
Member Avatar for picklesandmayo

I am writing a program that generates 2 random #'s then asks the user to give the product of the 2. I have everything (close to) working except the input. I even added a "cheat" to display the answer [inlineCODE]prod[/inlineCODE] and when inputting the exact same #, it is registering …

Member Avatar for vmanes
0
95
Member Avatar for anshul.dilli

hi plz help me overcome a few errors in my encryption project.... thanks [CODE]#include <iostream.h> #include <stdlib.h> #include <fstream.h> #include <stdio.h> #include <string.h> #include <dos.h> #include <conio.h> char passwrd[6]="",pw[7]; char pass[7],code; void genpassword(); void getpassword(); void doCrypt(char *cool) { int cryp; //the main int this function uses char x; //to …

Member Avatar for anshul.dilli
0
108
Member Avatar for picklesandmayo

I have a switch statement with 2 functions. I put 2 test [inlinecode]cout [/inlinecode] statements, both of which get displayed, but only one function is actually performed. A third test [inlinecode]cout [/inlinecode] statement is made in the second function, but that does not get displayed. "switch" and "switch2" get displayed. …

Member Avatar for picklesandmayo
0
100
Member Avatar for johnnyjohn20

Hi, I am trying to set up a program to allow the user to enter an odd number between 3 and 31. The program will then divide 360 between 1 and the user input-1. For example say the user enters 7, the program should divide 360 to each value 1, …

Member Avatar for vijayan121
0
106

The End.