49,757 Topics
| |
I have a problem that ı could not understand. [CODE]#include <cstdlib> #include <iostream> #include <stdio.h> using namespace std; struct record { char name [20]; double ave; }; int main(void) { int x,y; struct record array1[3]; struct record array2[3]; FILE *a; a=fopen("in.txt","r"); for (int i=0;i<3;i++) { fscanf(a," %d",&y); array1[i].ave=(x+y)/2.0; cout << … | |
Hi, I was wondering if you can help me figure how to go about this problem. This is what I have to do: Write a programme to generate an array of 100 random integers. [B]While the array is being filled incrementally, produce a sorted array by comparing the new element … | |
There are n persons numbered from 0 to n - 1 standing in a circle. The person number k, counting from the person number 0, is executed. After that the person number k of the remaining persons is executed, counting from the person after the last executed one. The process … | |
Hi, I've been working on this code but recently there's been a problem with a section of my code, this being that there was a stack overload but now, the code just stays in a loop saying that there is an invald arguement. I don't know how to get it … | |
I am doing a project for school that requires me to make a program that asks the user to enter a date by selecting two options for the format 1.MM/DD/YY (in numbers) 2.Month ,DD, YY (with the name of the month entered) both options should then display the date in … | |
i m confused about sprint syntax- i need to create dynamic mysql query so i have to use it, when i take char * it shows a error while when i take char arr[100] (like this )it work fine.. i read syntax from sprint from multiple sites, and it make … | |
Hello DaniWeb! I've been struggling with a small detail of this program for a few days now, and haven't come up with any solutions on my own. The basic gist of the assignment is to fill an array with random numbers, sort it, and then search for a number in … | |
Hi friends, I know this is such a freak code, but out of curiosity I did it to see memory usage increase using new operator. [CODE]int main() { char* a; for (;;) { //cout<<&a<<endl; a = new char[10]; } }[/CODE] As you see line7 is commented. When i run this … | |
I have a program where I have to put an input file in. Can someone tell me which direction to go in to where i can have my program calculate the data from the input file? | |
Okay so I know practically nothing about creating mathematical applications in C++ but am trying to learn. Practically everything I search for isn't anything close to what I need. Basically, I need to lean how to make a calculator style app first before continuing on, however I can't find anyone … | |
Ok! so im making a simple highscore type thing. the person plays the game and receives a score within the game. At the end of the game i have it currently comparing the score received with the score already in place within the highscore text file. the problem im having … | |
This is a function that will find the factors of a given number for you. EDIT: Better algorithm using vectors (thanks all at cprog :) ) | |
hi . plz I need you to explain for me how i can write a function that return the mod of array with n value . i think mod is that sample mode is it ? i am try to solve . but my code print the number taht is … | |
Hello everyone, this is my first post. I am working on a school assignment and I am stuck. The assignment involves reading a file that contains course subjects and the maximum number of students that can take the class. The contents are entered into an array sorted alphabetically by the … | |
I've been snooping around trying to figure whether or not this was completely safe. I've noticed that if you were to simply "delete this" you might have occurrences where the deleted pointer is still in use elsewhere in the program. To prevent this, you'd need to dereference it and perform … | |
Please Help how can i delete a lines from may .txt file someone help me :D my .txt file had a data please so body help me :D:-/ | |
hi there am wondering about the space between the [COLOR="red"]"[/COLOR] and the [COLOR="red"]%[/COLOR] scanf([COLOR="red"]"[/COLOR] [COLOR="red"]%[/COLOR]c",&choice); what's the different if i leave no space? | |
I am writing an importer for a custom export script to load mesh information for models. I tested my algo with small files, 20-30 kb of information with success, but when I try something bigger like 400kb(not that big mind you), the file fails to open. This is the significant … | |
ok lets say that we have the numbers 5,67 and 128 (the numbers are randomly entered) i want in first loop read the last digit means 5,7,8 in the 2nd pass i want the tenths so will be 0,6,2 in the 3rd will be 0,0,1 and so on. what i … | |
Hello, I have this on going project for my C++ class, dealing with a random number generator guessing game. I'm on the last step, finally. I gotta add functionality to output the array of guesses to a file after the answer has been guessed, and I need to include exception … | |
first i am creating socket, with that socket descriptor i am sending some no. of bytes through sendto(....) function. At the time of receiving through recvfrom(....) function, my code was hanging if the specified destination address is not available. Suppose if destination is available the it's working correctly... Why this … | |
Hey. As you know I'm a newbie in C++ and I'm learning from some source codes and eBooks. I don't know if the problem is to me but when I try to compile the code an error shows. I don't know if I should copy this code but I read … | |
I've been trying the last few days to get this code to work but it still wont return the exact numbers. Its always atleast like 10 characters off and it probably is a trivial answer but I cant find the solution. I've initialized the charCount to 0 but still it … | |
Hello World, I'm a c++ beginner and i've diced to study. So this is my first code: [CODE] #include <iostream> using namespace std; double d = 2.2; int i = 7; void some_function() { d = d + i; i = d * i; printf("%d\n", d); printf("%d\n", i); } int … | |
i want to know the sequence of values tobe printed out by this algorithm count = 0 while(count<2) print the value of x x=x+2 else print the value of x my answers are as follows 0;2 i need clarity | |
Regardless of what I do, the program won't run without crashing... any luck on how to fix it? [CODE]#include <iostream> #include <string> using namespace std; class DayOfTheWeek { public: void setDay(string); void printDay(); string getDay(string&); string plusOneDay(int); string minusOneDay(int); string addDays(int); private: int day; int toNumber(string); string toName(int); }; int … | |
Hello, I started my homework and I couldn't complete it. Can anyone help me with it?? the question is: Implement the depth-first search algorithm so that it accepts input from text file in the following format: List all distinct vertex symbols (use just a single symbol: A-Z and 0-9) one … | |
In my set.h file - template(class T): [CODE]template<class T> class set { public: void add(const T& item); private: } #include "set.template"[/CODE] In my set.template file: [CODE]template<class T> void set<T>::add(const T& item)[/CODE] In my main.cc file (where cset1 and cset2 are both set<char>): [CODE]cset1.unian(cset2);[/CODE] The error: [CODE]error: no matching function for … | |
I have made a program which the user will input the total inputted numbers and record it as an array, sort the biggest and smallest number, post the original inputted number, reverse the original's order, and lowest to high order. I have done the recording, sorting, however, when the program … | |
I am working on some code (not written by be, and too big to fundamentally change the structure of) where a pure virtual Image class is implemented. The user is expected to implement a function of their derived Image class with signature: [code] virtual Rgb* GetRgb(); [/code] Where the Rgb … |
The End.