19,876 Topics
![]() | |
I'm new to C++ and I'm having so much trouble with this problem. I honestly don't know what I'm doing wrong, I've tried everything but I still can't seem to make the program work. This is the problem: Write a program that reads in ten whole numbers and that outputsthe … | |
I have added some additional code to the Get_PrintDC function of my Sipprt.c code so as to get the print out in landscape rather than the default portrait format. The code reads as follows (the additional code is inserted after the return CreateDC line): HDC NEAR Get_PrintDC( void ) { … | |
Evniorment : Windows 7.0 , C++ , Multithreading I have created a new worker thread to receive data on socket & add it into static multimap. **code snap :** //remember mymultimap is static data type static std::multimap<string,string> mymultimap; EnterCriticalSection(&m_criticalsection); mymultimap.insert ( "aaa", "bbb") ); LeaveCriticalSection(&m_criticalsection); At same time my main … | |
Hi, I'm having a minor problem with output with printf. I understand you escape % in printf with %% so if I had some string it would be printf("%%eax"); But if I have printf("%%%s", registers(C)); I get an an output of %%eax, which is one too many percent signs. I … | |
Hello Friends, First of let me clear you that it not a fake blog.This blog is created for the students of computer field and sharing the programming concept to the people of IT.From this you will be connected with latest technology and programming questions with answer.Friends this just an beginning … | |
string location = Environment.CurrentDirectory; string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" + location + "\\harita.accdb"; // get records from the Shippers table string commandString = "Select x from map"; //create the data set command object and the DataSet OleDbDataAdapter DataAdapter = new OleDbDataAdapter(commandString, connectionString); DataSet ds = new DataSet(); // fill … | |
The following code block is producing and endless loop and I can't figure out why. Note that charv is just he second command line argument in the main function. int testNumber = 1; while(argv != '\0') { std::cout << testNumber; argv++; testNumber++; } I wrote this piece of code just … | |
so i was wondering if my program could be converted to a string version, if so gimme a start please. I also would like to find out how to set my speed variable if when entered it is less than zero for it to display an error statement, how would … | |
how to represent an exist directory into an XML file ?? is there any system call to do that or there is a good built in library to use it ??? I wrote this #include<stdio.h> #include<stdlib.h> #include<string.h> #include<dirent.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> int main ( int argc, char … | |
Is there a way we can decrement a file pointer. I searched online and I found the ungetc() function but what if we want to decrement the file pointer to point to the last string in the database? Also, how does ungetc *put back* a character?? Explain. Thanks in advance!! | |
I am trying to open a text file which contains a dictionary of english words. Each word and it's definition are on the same line and the entries are delimited by a newline. Now, my question is that if you open a text file using fopen() in "rt" mode then … | |
Hi, can anyone please tell me how to create a array of 20 crore (200000000) elements. I tried, but getting runtime error, might be that much memory is not available. Thanks | |
I'm trying to write a web server but with the code I have but I'm getting the GET/ht.html can't be opened. The html document (ht.html) is supposed to be opened in the browser. What can be added or changed so it'll work properly? The code I have is: #include <sys/types.h> … | |
I am writing a program about sorting an int array. What I have to do is to just modify the pointer array so that the original content of the array will not be changed. Noted that it is not allowed to creat an new array. So what should I do … | |
Hello friends did anybody have implemented the ant based clustering algorithm in C.If so can u pls pass me on the coding.It would of great help to me. | |
#define StackLimit 50 // ôï üñéï ìåãÝèïõò ôçò óôïßâáò, åíäåéêôéêÜ ßóï ìå 50 #include <stdio.h> typedef int StackElementType; // ï ôýðïò ôùí óôïé÷åßùí ôçò óôïßâáò //åíäåéêôéêÜ ôýðïò int typedef struct { int Top; StackElementType Element[StackLimit]; } StackType; typedef enum { FALSE, TRUE } boolean; void TraverseStack(StackType Stack); void CreateStack(StackType *Stack); … | |
I need help in this c program i need to have a delete function that will delete a specific string(or a line) in my FILE Is reading the string from the file and putting them in an array, okay? #include <stdio.h> #include <string.h> struct { char title[100]; char author[100]; char … | |
**I Know Main is a primary funtcion in C...But Is there other reason ..like why they named it as main only and not other??? ..and why we have to write main() compulsory in prgoram...Any histroy behind it??** Help ME Please....... | |
#include <stdio.h> #include <stdlib.h> #include<LPC214x.h> #define ledon IO1SET #define ledoff IO1CLR void delay(int x); #define READY 1 typedef int (*compfn)(const void*, const void*); struct task { int task_id; int period; int wcet; int arrival_time; int deadline; int state; int ceu; }; int sim_time=10; struct task array[3] = { { 1,4,1,0,4,1,0 … | |
So i'm trying to make multiple clients logon to a server through filesockets, and perform simple commands like ls -l, ls, mkdir. I've managed to make one client recieve output of ls -l command, sometimes, its buggy. Now i've been sitting for days trying to figure out how to fork() … | |
Hello everyone!I have started the book Algorithms in C by Robert Sedgewick and at the end of each chapter there are additional practice problems for solving.I stumbled on one that I can't seem to understand.It goes as follows: Write a function int convert() that reads a decimal number one character(digit) … | |
Write a C program that prompts the user to enter integers (positive or negative, not including 0) from the keyboard. Your program should stop reading the numbers from the keyboard when the value 0 is entered and print the range (the difference between the maximum and the minimum) of the … | |
#include <stdio.h> #include <stdlib.h> #define PRECISION 3 double absD(double n) { asm( "_absD: \n" "pushl %ebp \n" "fldz \n" "movl %esp, %ebp \n" "fldl 8(%ebp) \n" "fxch %st(1) \n" "fucomp %st(1) \n" "fnstsw %ax \n" "sahf \n" "jbe L2 \n" "fchs \n" "L2: \n" "popl %ebp \n" "ret \n" "fldl … | |
I'm trying to write a web server but with the code I have I'm getting 'open failed'. The html document (ht.html) which is supposed to be opened in the browser. It seems as though the code I have is not opening the file received through the socket hence it's saying … | |
Hi everyone! i'm getting strange outputs for the following code.. can anyone explain the reason for such output?? :/ I use DEV c++ int color_choose(void) { char clr[10]; int i; /*enum { green,aqua,red,purple,yellow,white }a;*/ printf("\n\n\tText color can be changed here! This the list of available colors: "); printf("\n\n\t Green\t Aqua\t … | |
When we open a new file using the FILE structure and fopen(), the file pointer points to the first byte of the file. How can we know the location of any byte in the file using the file pointer? When I try to store the location of fp (file pointer) … | |
I have to divide a database and I wanted the statistics of each subdirectory that I am going to create. The database is a dictionary comprising of words and their corresponding phonemic translations. https://cmusphinx.svn.sourceforge.net/svnroot/cmusphinx/trunk/cmudict/sphinxdict/cmudict_SPHINX_40 the database can be found here. I have written a program to count the number of … | |
hi, i am working on a project in which i did some calculation on a pic24 microcontroller and now i want to send that information by uart to a bluetooth device(RN-42). the bluetooth module then sends it forward to the pc. the trouble i am facing is that i dont … | |
Hi. The function msgget from sys/msg.h is not being recognized by Netbeans 7.2.1. Have I missed anything? OS: OpenSUSE 12.2 "Mantis" #include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/msg.h> extern void exit(); extern void perror(); int main(void) { key_t key; int msgflg, msqid; fprintf(stdout, "All numeric input is expected to … | |
Hello All, I am very new to C programming but i was working on cryptography for ipsec and am trying to write a code for implementing a simple code for a stream cipher which will take a 20 charecter long string and a 8 bit seed file and encrypt the … | |
Hi people. I wonder how I can free the pthreads' allocated memory? #include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NUM_OF_THREADS 10 void* print_thread_id(void* tid) { printf("Greetings from thread %d\n", (*(int*)tid)); pthread_exit(NULL); } int main(int argc, char* argv[]) { pthread_t threads[NUM_OF_THREADS]; int status, i; int* n_thread; for(i = 0; i < … | |
Hi I have a little C-program and when I run I discover alot of page fault?! How can I improve my C program to have it faster? | |
Okay, so pretty much I have to use structs to print out information about 4 dogs. However, I can only get the first dog, Smokey's information to print. Any advice on how to get the other four to print? #include <stdio.h> #include <stdlib.h> #include <string.h> #define pause system("pause") #define SIZE … | |
I was attempting to recreate the fibonacci sequence and I made a working code but my code will refuse to use a number above 12. any ideas what is wrong? #include <stdio.h> #include <stdlib.h> int main() { const int user = 1; long int fib[user]; int i = 0; int … | |
Hello, Though I have done this question without string functions but can anybody give me short algorithm for this. Here is the question: Write a program that reverse the words in a sentence: Enter a sentence: *you can cage a swallow can't you?* Reversal of sentence: *you can't cage a … | |
Hi I have the following code which is giving an error while trying to use scanf with it. Please help resolve uint16_t x[3]={1,2,3}; uint16_t y; printf(" %"PRIu16",y); (works) printf("Enter a value for y: "); scanf("%"PRIu16, &y); warning: format '%u' expects argument of type 'unsigned int *', but argument 2 has … | |
Help, I am getting a segmentation error. Basically I need a function to print out certain elements of an array. I have created the functions displayArrayVal1 and displayArrayVal2. x_array and y_array are both global. Where am I going wrong? #include <stdio.h> #include <stdlib.h> #include <string.h> #include <inttypes.h> uint16_t x_array[8]={1,2,3}; uint32_t … | |
I have a lot of problems understanding the concept of size_t and will really appreciate if anybody can help me understand the concept. I searched a lot on the net and went on a multiple forums and answers ranged from "it's an unsigned integer type" to the more bizarre "it … | |
What is a new project programming ? Is it better writting code in separate files which they can combine together ... rather that making ine file that includes all the other .C files ? At last... if i have 3 files .. for example: **File one:** // * Filename: setadt.c … | |
hi there, i also have an emergency home work it about Fibonnaci recursive the Output is should be like this : -------------------------------------------------- First number of the fibonnaci : 3 The Fibonacci Lines are : 3 4 7 11 18 29 ... ---------------------------------------------------- i want the result is until 10 lines … | |
A fest called "Technothon" is going to be held in my college. In this fest, CEO's of large MNC's are invited. I am to present a project in front of them. So, please suggest some project ideas.. "C" language is my strong point. But i have got no idea about … | |
Hi, I am facing difficulty in removing a node from linked list. For example I am having four nodes having integers (10) (20) (30) (40). I need to remove second Node that is 20 from linked list. What i was trying to do is I am maintaining two pointers to … | |
**I have about 54 errors and I have no idea why. I've been looking through it and I see nothing whenever I change anything, more errors that are related to previous** 1>------ Build started: Project: TESTERPROJ, Configuration: Debug Win32 ------ 1> blank.c 1>c:\users\pauline medwinter\documents\visual studio 2012\projects\testerproj\testerproj\blank.c(33): error C2122: 'long' : … | |
N 10*N 100*N 1000* N 1 10 100 1000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000 6 60 600 6000 7 70 700 7000 8 80 800 8000 9 90 900 9000 10 100 1000 10000 Hi, [code=c] #include<stdio.h> int main() … | |
Hi I am looking for some information regarding VT102 escape codes. Are there any tutorials on this anyone can recommend? Basically, what I need to do is overwrite these print statements within the for loop to my screen: for (int i=0;i<5;i++) { printf("Enter the current price of the product: "); … | |
A 4 byte float has the value: 0x7F800000. Its value as a floating point number is: a. -39.482 b. +0.0 c. 11.0 d. +Infinity Hey there, I was hoping to solve another problem but I need help. I was wondering how I would convert the value to the desired answer? … | |
I ran same code linux and HP platform And the result stored was different. I found that the boundar for comparison is 255. It can be more undersstood from the below code. #include <stdio.h> int main() { FILE *fp=fopen("linux2.txt","wb"); int a = 100; int c=0; int i=0; for (i=0; i … | |
Hi All, While running a piece of code on Linux and HP i found the differenc in the result. Can Anyone Explain Why it is giving different results? #include <stdio.h> int main() { int a = 0; int b = 30030; int c = 34094; int d = 0 ; … | |
Hi I have data in the following format that I need to write to a csv file. Student1 Mark1 Mark2 Mark3 Mark4 Mark5 Student2 Mark1 Mark2 Mark3 Mark4 Mark5 Student3 Mark1 Mark2 Mark3 Mark4 Mark5 Student4 Mark1 Mark2 Mark3 Mark4 Mark5 Student5 Mark1 Mark2 Mark3 Mark4 Mark5 I am writing … | |
Hi All, I have a binary search tree (consider following structure). struct bst { void *value; struct bst *left, *right; }; I want to save this unbalanced binary search tree in a file. And when I read this file, I don't want to recreate the tree from these nodes. So … |
The End.