19,876 Topics
![]() | |
Here is my current situation. I have a global array and it is originally declared as an int pointer. I malloc (100*sizeof(int)) to this pointer in the main method. I then use this array to store values and these values are assigned inside of two for loops. The problem is … | |
K...so this is an airline reservation program I have been working on for school and I can't see where I am going wrong. Basic functions of this would be taking reservations for either first class or economy class seating on a 10 passanger plane. seats 1-5 are supposed to be … | |
I want my code to take two characters and print them, but this code only takes one character, prints it and terminates, can you please tell me what's wrong with it? Thank you. [code=syntax] #include <stdio.h> int main() { char a, b; scanf("%c", &a); scanf("%c", &b); printf("%c %c\n", a,b); return … | |
HELO EVERY BODY I NEED HELP WITH THE FOLWIN ASSIGNMENT PLZ 1- The programming assignment ( The number-guess assignment ) The main issue of this assignment is to guess a random number in a well defined range. The machine will select a random number; the program will try to catch … | |
When this program prompts the user for input, it works fine for the correct input. But for the wrong inputs, it returns a zero for every character, including the white spaces. My goal of this program is to return a roman numeral as an integer. For the wrong inputs, I … | |
I'm trying to get this program to ignore leading tabs and blanks, but I just can't seem to figure out how. What can I further do to improve this program? [CODE]/* Read a command, skipping over leading blanks and any trailing * characters. */ #include <stdio.h> /* Declare functions */ … | |
Hello, I just only want to ask.How to connect MS access database to a C program.See the code below: #include<stdio.h> char firstname[20], middlename, lastname[20]; main() { clrscr(); printf("Enter your First Name: ");scanf("%s",&firstname); printf("Enter your Middle Name: ");scanf("%c",&middlename); printf("Enter your Last Name: ");scanf("%s",&lastname); getch(); } This is what I want to … | |
The following code when compiled gives the error: "i[B]nvalid conversion from `void*' to `f*' "[/B] What is wrong with it ? [CODE] typedef struct a { int* value; struct a* p; int r; }f; f* m(int* value) { f* node = malloc(sizeof(f)); node->value = value; node->p = NULL; node->r = … | |
Please help me to transform this phonebook porgram into a linked list phonebook program with delete function..This is my code... [CODE] #include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> struct info{ char name[50]; int TelNo; }; struct info gab[50]; int rec=0; char ch; char search[50]; int c; main() { do{ do{ clrscr(); printf("Phonebook"); printf("\n1 … | |
i have this code: [code] int main(int argc, char* argv[]) { remove(debug_file); count=0;//count d number of seeding for (int i = 1; i < argc; i++) { /* Check for a switch (leading "-") */ if (argv[i][0] == '-') { /* Use the next character to decide what to do. … | |
Hey Peeps....... I want help regarding CORE FTP( File Transfer Protocol) Client. i have got its password storage location. it stores it in registry as like this: [B]Hkey_current_user/software/ftpware/coreftp/sites[/B] I want to know that how this FTP encode its password in this file. Do you have any knowledge of its working...any … | |
Hi guys o/ ! I'm trying to make a program that write in text file some datas. Then, i wrote a header that have all functions I need to write in this file. thas is my header: [CODE] #ifndef _SNAPSHOT_H #define _SNAPSHOT_H #define LAST_PRICE 0; #define BEST_ASK 1; #define BEST_BID … | |
Hi, I transferred Uni, and got an advanced standing for some prior study, but the current unit I am enrolled in builds on an advanced understanding of ADTs (and link lists etc). Problem is that - I have not previously learned this information. My unit text - Algorithms in C … | |
I want to try to understand the method of using POSIX threads to interact with a sorting algorithm such as the odd-even transposition sort. I have written my program to do a odd-even transposition sort without threads and this is my current result: ./sort data File opened successfully. The numbers … | |
I'm trying to write a program for class and I can't get my fractional exponent to work. I've tried using 2/3 2.0/3.0 and I've tried entering 2/3 into a separate variable, but nothing seems to work. I don't get any errors while building 2/3 but the logic does not come … | |
Hey all, I was just wondering, is it safe to do something like this? [code] char *msg; sprintf(msg,"Forename: %s", fname); //where fname has been previously defined as char fname[ ] = "Jonathon"; [/code] My main query is around the allocation of the memory for msg. I know there are memory … | |
Hi im writing a C program to read in wav files. How am i able to VERIFY/CHECK whether the wav file have been read in correctly inside the C code? do i do a printf or something like that? thks. | |
hi friends i m a comptr eeng. student ı saw your codes then ı felt bad because ı think ı should improve my codes ?so how can improve my codes?ı m 2.class student..thxx | |
Actually this is not an assignment or anything... School days are done... Still there's lot of things that i don't know... I just need some ideas on how to make an inventory using files... Basically, the file contains the name of the "Items" "Prices" and the "Amount"... I want to … | |
could you help me????? how can i get an output like this: 2+9*32/3%2=96...it depends on the user on how much operators that he want to use. please help me of what statement that i have to use to have an output like this..... please post an example statement......... | |
Hi I am trying to cross compile a simple program for Windows CE using CodeBlocks. I am using mingw32ce (part of CEGCC) which is a set of tools and libraries for building WCE programs on XP. And some WCE SDL libraries I found here: [url]http://users.uoa.gr/~knakos/scummvm/libraries/release-0-10-0/wince-gcc-libs.tar.bz2[/url] I have succeded in building … | |
please give me the "C" language code for reversing a two dimensional character array. a two dimensional character array is sent as a parameter to a function which in turn returns the reversed char array. kindly note please give the answer with a two dimensional array only and also only … | |
I am trying to make a program so that you can enter your name, but I want to limit the amount of characters used to 10. This is what i have so far, and when i press backspace on my program, it doesn't delete the previous character but moves the … | |
Hi everyone, I am having problems with my c++ code for about 2 - 3 hours now and decided I need help. I am a student at a college and I am trying to code this for my assignment. cpp file:[CODE] #include "bridgehand.h" BridgeHand::BridgeHand() { for (int x = 0; … | |
i need help on how to make a calculator program on C. for example: 100+3*(344-45)-3/20= ? ive done a part of it, but it doesnt even give the right answer. the user inputs anything (excluding letters and some puncts). it accepts the equation as a string. ive already converted the … | |
I have downloaded relo with mingw compiler. How can I run programm with it? or I should download somthing else? Or maybe you can write me some commands with which I can compile and run programm in command line. thank you | |
Hey Every Body can u PLease help me with this this is a code 4 RSA it is workin' for small values of {p,q,e} like {11,3,7} but it does'nt work for {11,17,7} Please help me at this POint even long double is not enough for storing the value of c[i]^d … | |
[CODE]#include <stdio.h> #include <stdlib.h> #include <string.h> #define TRUE 1 #define FALSE 0 #define BUFFER_LEN 240 #define NUM_P 50 void str_sort (char *[], int); int main () { char *s[NUM_P]; int count; printf("Enter the number of count:"); scanf("%d",&count); int i = 0; printf("enter the first string:"); scanf("%s",&s[0]); printf("enter the second string:"); … | |
I am having problem understanding nested loops, esp in making patterns with them. I am able to understand simple loops like these: [CODE]ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ ABCDEFGHIJ [/CODE] code for this will be: [CODE]#include <stdio.h> #define ROWS 6 #define CHARS 10 int main(void) { int row; char ch; for … | |
Hi, Thanks to the help on my other posts I am starting to be able to manipulate Excel through C# quite successfully. My new question is: I am just about to register a domain for the purposes of personalised email. I don't have any particular need (at the moment) for … | |
Hi I have a double *ptr which I use as an array. I am trying to send the address of the ptr to another sub processor. But I can only send 32 bits to the other processor.So its giving me an error makes pointer of type integer without a cast. … | |
Hi, I'm trying to write a program that will continuously pull up a text file, search it for anything new, and create/change a different text file if there are ever any differences in the "myfile.txt" that is being constantly searched. The problem is, when I run my code, it consumes … | |
If a user enters [CODE]0 0 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0[/CODE] how do I read it in as [CODE] 00000000111010000000011111100000[/CODE] | |
been doing reiew questions to prepare for a c++ test, and was hoping someone could help me out by looking over the ansewers i have so far. what i have is in red. thank you very much :) -- Which of the following operations has the highest precedence? a. Postincrement. … | |
Hello, I'm new to programming forums so go easy on me :) I'm working on an assignment for school. I have to read a quiz.dat file which cotains info in the format of: TTTTTFFFFFTTTTT TTTTTFFFFF TTTTJoe Jones TTTTTFFFFFT TTFMary Jane ... ... etc. The first line being the answer key … | |
got some noob c++ questions that hope someone can help me with ---The statement while ( --counter >= 1 ) counter % 2 ? cout << "A" : cout << "B"; cannot be rewritten as: a. while ( --counter >= 1 ) if ( counter % 2 ) cout << … | |
Hi I am trying to get this program to work to insert a node into the list and move the list down so the node will fit. I get the node to be inserted into the right place but the list is copied as such. if 1. joe 2. linda … | |
So guys for the sake of simplicity lets say i am developing a huge matrix multiplication program using C and i made a data structure which is able to represent this huge matrix into miniature blocks the down side is that this representation of block takes much more memory than … | |
Hello, How can i change the root directory to the current working directory.. I need to use some form of an exec call to run a program found in the current working directory but the problem is that the path of that program is required to start with '/'.... my … | |
So I have the following implementation of linked list: [CODE=c] #ifndef LINKED_LIST #define LINKED_LIST struct Student { char* name; char* surrname; char* signin_number; char* grade; char* date; struct Student* next; }; struct Student* begin = NULL; void push_back(struct Student* student) { struct Student* temp = NULL; if(begin == NULL) { … | |
Hey I have a use for working with basic binary search trees but I cant seem to find good examples on the basic operations such as sorting, insert data, delete and search for data. Can someone give some basic examples? Thanks. | |
I have written a program for a linux box running on a davinci (arm processor). The program communicates with a server over the lan, calls some scripts, and delays different amounts of time depending on what the server tells it to do. It all works great, most of the time. … | |
Hello, I have been stuck with a C program, which I have to write for my foundation degree. I know it's simple, but can't seem to wrap my head around it. Write a program that uses a For loop to: Input three float numbers less than 20 Cube each one … | |
I found this code somewhere on the net... But i dunno how to stop this...Its keeps animating and i dont know when will this stop... [CODE]#include <stdio.h> #include <time.h> void sleep ( long milli ) { clock_t end, current = clock(); for( end = current + milli; current < end; … | |
I tried to bubble sort but when i output it, it gives me funky numbers. Can you help me out. is the bubble sort even right? [CODE]#include <stdio.h> int sort(int a[], int len) { int x, y, t; for (x=0; x < len-1; x++) { for (y=0; y < len-x-1; … | |
Hi! I'm just started learning C++ and i tried to do a calculator for fun. I did not succeed :$ There is an error here that i cannot find... Please, if you find it let me know :icon_smile: [CODE]#include <iostream> #include <cmath> using namespace std; int main() { double num1; … | |
I have to now make a simple single line text editor where the letters i type i can use commands to edit them this is what I started with my knowledge and so far ive got typing happening, if its possible to just input commands that can change the lines … | |
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; { … | |
Hello there. I don't know if this should actually be posted in any of the C/C++ forums, but it is mainly an Assembly question so I take my chances here. In C/C++ it is possible to declare local variables as: [CODE=C]if(statement){ int var; // Use of the variables }else{ // … |
The End.