174 Topics
| |
Volunteer C++ Gurus. Thank you in advance for your time. This site has saved my sanity. I am working with my longWords function and cannot get it to stop displaying the same value (2293264). I know that my code is a little janky because I modified it from array format … | |
It's saying I have 6 errors. Need help, please..or a push into the right direction. Thank-you. :) [CODE]#include <iostream> #include <cctype> using namespace std; int Len_String(char *); int CountCapitals(char *); int CountVowels(char *); int main() { char msg[] = "Strayer - what a University !"; char msg2[] = "Programming is … | |
Hi I really need help figuring this one out I have been working at it forever. I am trying to pass an array of 3 pointers, which are themselves arrays, and get the sum of the last two pointers and store it in the first pointer. The pointerarrays are filled … | |
struct Employee { /* Employee details */ char name[MAX_NAME_LENGTH+1]; /* name string */ char sex; /* sex identifier, either 'M' or 'F' */ int age; /* age */ char job[MAX_JOB_LENGTH+1]; /* job string */ struct Employee *prev, *next; }; static void menu_add_employee(void) { static struct Employee *employee_list = NULL; { … | |
Here is my program so far: [CODE] #include <stdio.h> #include <string.h> #define max 200 typedef struct { char triple[6]; unsigned index; unsigned lower; unsigned upper; } mpn; unsigned load_MPN_table (mpn *mpn_table[], FILE* input, unsigned max_size) { unsigned i; for (i=0; i<max_size; i++) { fscanf(input, "%s%u%u%u", mpn_table[i]->triple, &mpn_table[i]->index, &mpn_table[i]->lower, &mpn_table[i]->upper); // … | |
Having a problem setting user input to a dynamic array. It worked with a static array, but now I'm having some kind of pointer issue. The user sets the dimensions and enters in a number of characters, which should be set to the array 'gameboard'. it's just setting jibberish though. … | |
[CODE]#include<stdio.h> #define CR 13 #define LF 10 int main() { FILE *tg; FILE *th; FILE *printer; int i,a; char input[20]; char file[100]; char input2[20]; char file2[100]; printf("Enter the file name for reading : "); scanf("%s",input); th = fopen(input,"r"); printer = fopen("PRN","w"); do { i=fgets(file,100,th); putc(i,printer); printf("\n\n%s",file); }while(i != EOF); printf("Enter … | |
1. Manipulate dynamic pointers and arrays of pointers 2. Use sorts, strings, searches and string functions. Procedure: 1. Your new software engineering group is hired for its first paying project to develop a console application to demonstrate a possible user interface for a next generation MP3 player. 2. Your C++ … | |
I'm working on my first game in C++ and SDL. The game compiles and runs perfectly on both my boxes (Arch Linux and Windows XP). When two of my friends were to test the game, one of them (running Windows Vista) said his machine BSoD'd every time he ran the … | |
Hi, I have been working on this program for quite some time but I can't figure out what's wrong with it. The program compiles and this is the the output I get: ?Invalid number of arguments Press any key to continue . . . Can somebody please take a look … | |
Hi guys having a single problem with some code. The program is statically linked to another which is suppose to take an input from a text file into an array; and then return a pointer to the array to the main program. The text file contains 10 ints one per … | |
Hello, First of all, excuse my English =) Warning: wall of text\code. I must say I have some experience in Java and long forgotten C++, so right now I have some problems implementing the Huffman coding. The algorithm goes like this: I create an array of 255 elements to represent … | |
Hi All, I'm stuck on my C++ assignment. I have no idea how to finish it...I think I'm missing something in my code such as how to double the size of the argument array and copy it, then initialize the unused elements of the second array with 0. thanks in … | |
question: Two pointers that point to different arrays cannot be compared meaningfully. That's false right? because they can be compared in the same manner as integers are correc? if i am wrong please explain y or if u have anything to add please do!!! | |
[CODE]# include <iostream> using namespace std; void init(int *Ptr, const int &s); void display(int *Ptr, const int &s); void sort(int *aPtr, int s); void swap(int *v1Ptr, int *v2Ptr); int index_of_next_smallest(int *aPtr, int *SiPtr, int s); int main() { int size, count; int *nPtr; cout << "Enter the size: "; cin … | |
I was wondering if [CODE] *pntr.age = 19;[/CODE] is valid considering that pntr is a pointer to an object that has age as a varible. If it is valid, can it be used with an array of pointers to objects? if yes can i get an example please? thank you. | |
I am very very blurry about when to use pointers or not. I am writing a function (given below), and trying to pass in two variables, statenumber and state. I have them being passed in as chars, and not char *s. I get error messages both ways. I dont know … | |
heya.. i wanted to ask if there was a way to give a pointer to a multidimensional array of, say, ints, as a function argument. i tried a somewhat natural approach, which seems to have failed.. i'm no expert at stuff like that, so i tried: [CODE] int numbers[ 10 … | |
I have a general doubt regarding passing pointers to functions... Suppose i have variable [code=c]tc_struct *ptr;[/code] and i want to pass it to a function to fill it. So i passed it [code=c]func(&ptr);[/code] and i received it in func as [code=c]void func(tc_struct** ptr1)[/code] Now again i want to pass this … | |
Hi guys, I'm pretty much a C newbie, but I've dabbled in other languages over the years. For my current project I'm using mikroElektronica Pro C on a PIC microcontroller. I've got a 2-dimensional array defined like this: [CODE]const char FONTTABLE[96][5]= { {0x00,0x00,0x00,0x00,0x00}, {0x00,0x00,0x5f,0x00,0x00}, {0x00,0x07,0x00,0x07,0x00}, /** [90 rows snipped] **/ … | |
Hello friends, I have a code snippet related to pointer increment and decrement. [CODE]int arr[] = {1,2,3,4,5}; int *ptr; ptr = arr + 2; printf("%d %d %d %d %d %d\n",ptr,(ptr+1),ptr--,ptr,ptr++,++ptr);[/CODE] It is giving console output as: [B]1245020 1245024 1245024 1245020 1245020 1245020[/B] I am a bit surprised with the third … | |
Hello, So lately, I've been coming across this issue of mine and can't seem to find a solid way around this problem. My problem is due to the fact I'm using MYSQL C connector library. And, Attempting to gain all the Row's from my database and store them in a … | |
Seems that I'm going to get hung up on every CandyBar exercise in this book I'm working through. Such is life. I'm doing something stupid, and I can't see it. Something appends garbage into my structure's first field when I try to give it the defaults. [code]#include <iostream> const int … | |
Good morning coders !, I stumbled accross an initialization this morning and even though I get it , it's not 100%. I'll simplify it this way: I have an array declaration: [CODE]uint8_t MyArray[MAX_SIZE][/CODE] I have a linked list structure: [CODE]struct MyLL{ struct MyLL * next; struct MyLL * previous; uint16_t … |
The End.