- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
65 Posted Topics
Re: For the testing just have the two programs accept the size of the array of numbers as a command line argument to sort then fill said array with random numbers. I did a similar project freshman year of college with quick sort and bubble sort as well and it makes … | |
So I'm using the >> operator to read objects from a file one by one. I am simultaneously counting the objects and need to read them again one by one to print from a certain point. inFile.clear(); inFile.seekg( 0, ios::beg); Doesn't seem to work for me, and I assume it … | |
Re: Like what Ancient Dragon said, but I can give you some hints. C style strings are pointers to characters, assuming you will be using <string.h> you will have the ability to use strlen( char *c ) strlen returns the length of the string, which you will need to know so … | |
so I haven't used pointers to this extent for a few years so I'm a little rusty. I'll give a quick explanation on what the code is supposed to do, but from looking at my output I am messing up pointer arithmetic somewhere along the lines. I'm pretty sure it's … | |
I've recently created a .dll project in Visual Studio using C++. I'm curious how Visual Studio is creating the ability to link the files. I got everything working properly but it seems I can get the project to work flawlessly regardless of where the .dll file is located. Once the … | |
I've attempted to create a linker for assembly files, what the program does is not the issue here though, I havent used pointer arithmetic in a few years and am definitely rusty in doing so. I'm getting a segmentation fault when I attempt to run the file and would like … | |
I'm trying to use the system call to append an arbitrary number of files to one specific file... when I attempt to run the program i get the error: sh: addints.o: not found sh: main.o: not found sh: rbyswt.o: not found sh: readint.o: not found sh: writeint.o: not found sh: … | |
I'm writing a program where I take in a file and need to grab strings of n length (n = 3, 4, 5, 6 ,7 or 8). The issue I'm having is I need to grab these strings in a specific window. So if n = 3 I need to … | |
I'm creating a fibonacci program in mic1, which is a little more readable than other assembly languages so even if you don't know the language it shouldn't be hard to figure out what the code is trying to do if you are good with stacks and recursion. This is the … | |
I'm working on a project where I have an executable file and the main function to the executable. The executable takes in 6 strings, one at a time, if the string matches what it is accepting then it will request the next string. The project is to use gdb debugger … | |
I'm trying to create a program to add two IEEE 754 floating point numbers, I'm pretty far into the program but I've come to a halt in the bit shift section of the algorithm. I have created a tmp variable to copy the mantissa(0's and 1's inside the char array … | |
Ok this has been annoying me for months but I've finally decided to act on it. My asus G50v(bestbuy version) is running excessively hot. Ive opened it up, the video card and cpu both have heat pipes going into a single cooling fan... My problem is this fan has died … | |
Re: Also what exactly do you mean by difference? Do you mean the ASCII number difference... or do you mean the third array is an array of bools. so the third array would be thirdArray[x] = 0 if firstArray[x] and secondArray[x] are the same and thirdArray[x] = 1 if firstArray[x] and … | |
Re: Header files usually .h are used to outline classes, and other files which need those classes include the .h file. In other words something like student.cpp will include student.h but there will be a main that also needs to include student.h. I'm not sure what you mean by resource files, … | |
I'm trying to create a menu using ncurses, I found some useful code and help online, but the code has errors in it. And I can't figure out why I'm generating this error. On top of all this, theres no way I'll be able to use the information I've found … | |
I'm writing a game where I create a map using ncurses. What I want to try and do(if possible) is make the map the size of the terminal, in other words in the main program I have: [code=C++] // Create a game on an 80x30 map Game gameInstance( 80, 30 … | |
I have an assignment where I'm supposed to "implement a class, Point that represents a point in a three-dimensional space." and im supposed to "carefully design the interface for this class and include functions that appear to be useful for operating on points." I'm not fully sure what this is … | |
Re: Well first off add should be void not an int... if your function returns an int... then it should have "return( some int )" in it somewhere. What are you trying to add in the program? right now your not adding anything that will be helpful to the user. | |
Can anybody help me understand how this design pattern works? I'm supposed to make a program that will create a tree using pointers or an array. The client is then supposed to choose which of the two types of trees he wants to use... I've created the tree with pointers, … | |
I wrote a program which creates an n-ary tree using the left child right sibling approach. Each node of the tree is labeled by a dynamically allocated array of ints. I am currently having a problem where if I am searching for a node labeled 1 2 3 4 5, … | |
I wrote a program to compare two text files character by character and its not working probably an easy thing im just not seeing. [code=c++] #include <iostream> #include <fstream> #include <string> using namespace std; int main(int argc, char *argv[]){ string s1; string s2; char c1, c2; if(argc !=3) { // … | |
Ok im creating a program to make a database of people associated with a university, these people are called universitypeople, i have another file universitydatabase which stores all these people and will edit their information... well im having these errors when i type make... the errors could be class based … | |
this is the error i'm getting. g++ main.cpp g++ universityperson.cpp /usr/lib/gcc/i386-redhat-linux/3.4.6/../../../crt1.o(.text+0x18): In function `_start': : undefined reference to `main' collect2: ld returned 1 exit status make: *** [universityperson.o] Error 1 I'm not going to post all the code i have but here is my makefile main file and universityperson files … | |
So this is just the beginning of my questions, but I'm seriously having problems using classes in C++, I'm writing a program right now to plot points using asterisks on a 40 by 40 plain. right now I'm just trying to write the .h for the point class and i … | |
Re: code looks fine at a glance, why dont you type it in and run it... the output should be 12 i think | |
I am supposed to create a program like this, with separate clock.cpp, clock.h, and main.cpp files. The program is supposed to do these tasks: I have started the clock.cpp and dont quite know where to go for some of the tasks, and I don't quite know how to use the … | |
Write a new program called paginate.cc. It should work like this: Usage: paginate [--lines-per-page #] [--columns-per-page #] [--tabstop #] file [...] Required command line parsing: The options may be given in any order, but must all precede the file(s) to be printed. Parsing the argument should simply deposit the associated … | |
What i have to do is read a string into a vector, then cop that vector into an array of character pointers, then for each element in the vector i have to allocate a new character array andcopy the data from the vector element into that character array. Then finally … | |
I honestly don't fully know where to start with this program but this is what i have Write a MIPS program which read one line at a time from console. For each line that you read, print two lines on the console: echo print of the line and types of … | |
I'm supposed to create a program to read in word by word into a vector. And print out the words connected with '-'... so if the input was hello world the output would be hello-world this is the code ive made so far... right now my input can be hello … | |
Ok, so yesterday my computer was basically in the dump, it was crashing every 10 minutes, and i couldnt do much of anything on it. So i ran Memtest and received 54000 errors... this morning i reinstalled windows cleared the hard drive and now the computer runs better then ever, … | |
Ok i know this has all sorts of issues, im getting tons of errors, any suggestion on where to start? [code=C] #include <stdio.h> #include <stdlib.h> typdef char byte; void memcopy( byte *to, byte *from, int count ) { while ( count-- > 0 ) *to++ = *from++ ; } int … | |
i dont understand why this isnt working ill post the code thats relevent for some reason no matter what numbers i enter it will just print out that the complex number is 0.00000... idk how to fix it heres the main function [code=C] #include <stdio.h> #include "globals.h" #include "complex.h" int … | |
Re: theres no need for a sorting algorithm in this code, just walk through the array one by one with the for loop that jephthah gave to you. and inside the for loop just do if( min > a[i] ) min = a[i]; and something similar to that for max. and … | |
Re: all i have to say is that is a lot of code for a new user of C, you should have line numbers on your error messages regarding undeclared variables, go to those line numbers and make sure the variables are spelled correctly... C is case sensitive | |
Write a program to compare two text files. The names of the files are to be supplied as command line arguments. The program should write a message to the screen indicating that the files are exactly the same or that there are differences. If the files differ, the program should … | |
There is a famous mathematical conjecture called the Goldbach conjecture, that every even integer greater than 2 has the property that it is the sum of two prime integers. Write a C program that will prove that this conjecture is true for even numbers between a START value and a … | |
im trying to write a program to see if two lists are equal im really kinda lost at the moment, i havent gotten the compare function yet but i think that should be pretty easy, but im having some errors which u can see. [code=C] #include <stdio.h> #include <stdlib.h> typedef … | |
Im really confused, I had this recursive add function working but my teacher wants us to be able to use ++ instead of + 1... anyone know why im getting a segmentation fault on this, i feel like this is a really dumb mistake. [code=C] int add( int n, int … | |
ok so im creating a program minmax to find the minimum and maximum numbers of an array. heres my code but i get segmentation fault where do you think im going wrong? [code=C] #include <stdio.h> #include <stdlib.h> void minmax( int numberlist[], int n, int *p_min, int *p_max ); int main( … | |
ok this code gets three sides of a triangle and prints out the area... but it just prints out that the area is 0 every time... why? [code=C] #include <stdio.h> #include <math.h> double area(int a, int b, int c); int main(int argc, char *argv[]){ int a, b, c; printf("\nSide A: … | |
Multiplying the digits of an integer and continuing the process gives the surprising result that the sequence of products always arrives at a single digit number. For example, 715 ---- 35 ---- 15 ---- 5 27 ---- 14 ---- 4 4000 ---- 0 9 The number of times products need … | |
Write a program that will compute and print out all positive integers that are less than and relatively prime to the integer 351. Two numbers are relatively prime if their greatest common divisor is 1. You must call a gcd function. so far i have this, it compiles and works … | |
Re: I'm not sure i fully understand your question either, but if you have a small program it shouldn't be that hard to find an error involving pointers if you show it to someone who is a little more advanced with pointers. If you already are somewhat knowledgeable and the program … | |
Re: if you change your printf to: [code=C] printf("%d%d", a, A); [/code] i believe it will will print out 79 | |
Re: divide by 10 to erase the right most digit use % 10 to single out the right most digit | |
I'm trying to complete a radix sort program, and i cant remember the algorithm to get the specific digit out of a number between 1 and 10000 heres the for loop which calls getdigit: [code=C] for( i = 0; i <= 4; i++ ){ printf("Pass %d: ", i ); for( … | |
Re: yeah, the point of calling a boolean function aka bool is to call a function that will answer the question is this true or false... in your function you are asking function add whether a plus b does not equal zero. if thats what you want to do then great … | |
Re: call the function with this: [code=C] addit(test1 + test2); [/code] then use this as the function definition: [code=C] void addit( int sumoftests ){ [/code] you are calling the function addit and sending it the sum of the two values. NOT sending it both variable test1 and test2... if you want … |
The End.