49,761 Topics
| |
what does the following do? int array[6] = { 5, 3, 4, 17, 22, 19 }; int* ptr = array[0] *ptr = -1; thank you! | |
[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 … | |
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 … | |
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> … | |
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) { … | |
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; … | |
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 … | |
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 … | |
| 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 … |
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 … | |
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 … | |
#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; … | |
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) - … | |
| 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 … |
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, … | |
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 … | |
[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 … | |
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 … | |
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. … | |
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 … | |
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。 | |
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 … | |
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 … | |
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 … | |
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 … | |
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> … | |
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 … | |
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 … | |
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. … | |
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, … |
The End.