19,876 Topics

Member Avatar for
Member Avatar for glao

(Continued from [here](http://www.daniweb.com/software-development/cpp/threads/474128/column-major-not-shown-right#post2070227) ) I am trying to use column major order to a 2d matrix which I am using as 1d. int N=3,R=2; for (int i=0;i<N;i++){ for (int j=0;j<R;j++){ //printf("\nX[%d]=%d\t",i+j*N,res[i+j*N]); //column major // printf("\nX[%d]=%d\t",i*R+j,res[i*R+j]); //row major } printf("\n"); } but the column major doesn not work as it should. …

Member Avatar for David W
0
440
Member Avatar for COKEDUDE

Can you please explain what this weird int declaration does. Here is the block of code. void show(void *u, int w, int h) { int (*univ)[w] = u; printf("\033[H"); for_y { for_x printf(univ[y][x] ? "\033[07m \033[m" : " "); printf("\033[E"); } fflush(stdout); } This is the line I'm talking about. …

Member Avatar for Ancient Dragon
0
264
Member Avatar for Jason_9

I'm totally new to programming and taking an intro class. When i prompt the user for a state code the program just exits, nothing in my book really goes over this and all im given is crappy youtube videos for reference. Any help is greatly appreciated. #include <stdio.h> #include <stdlib.h> …

Member Avatar for David W
0
271
Member Avatar for COKEDUDE

Can someone please explain what unistd.h does and the purpose of it? I have been googleing the last hour and I don't understand it.

Member Avatar for COKEDUDE
0
132
Member Avatar for claverchou

(Get "Temporary Internet Files" directory and files) const int cookies = 32; Shell32.Folder objFolder; Shell32.FolderItems objFolderItems; Shell32.ShellClass objShell; string strFolderpath = System.IO.Path.GetTempPath().Substring(0, System.IO.Path.GetTempPath().Length - 1) + "orary Internet Files\\"; objShell = new Shell32.ShellClass(); objFolder = objShell.NameSpace(cookies); objFolderItems = objFolder.Items(); foreach (Shell32.FolderItem objFolderItem in objFolderItems) { //MessageBox.Show(strFolderpath+objFolderItem.Path.ToString()); string strDeleteFile = strFolderpath …

Member Avatar for Illaya
-1
447
Member Avatar for ashley.vanhoesen.7

I am trying to create a palindrome checker using a single stack and pass by reference method. I just have to write the evalPalindrome() method and then I input it into a web application which holds the main. For some reason, however, when the main is calling the pass by …

Member Avatar for David W
0
695
Member Avatar for Mohamed_31

A space shuttle measured the distance between earth and Mars as a very large integer number of centimeters. Write a C++ program that reads such distance as centimeters and displays the kilometers, meters and centimeters equivalent.

Member Avatar for Elixir42
0
147
Member Avatar for churchill.omorere

Design a C program that will convert temperature values from degrees Celsius to degrees Fahrenheit. The user must enter a start and a finish value, together with a step value. The program must convert all temperatures beginning with the start value at the given step interval. Use the …for()… statement …

Member Avatar for BobS0327
-1
172
Member Avatar for jalferez1

i asked this on the C++ forum but someone told me to try it here on C. here's my first program there are some error with this program, i can't debug it. what's the problem? #include <stdio.h> #include <conio.h> #include <ctype.h> #include <string.h> int main(void) { int strlen, a, b,c; …

Member Avatar for jalferez1
0
220
Member Avatar for boris90

Hi! I've had this problem for a couple of days now, and I don't know what it is. My Visual Studio 2012 project worked perfectly before, but now it just hangs at the "Generating code..." part. It *litteraly* takes forever. I once left it for more than 30 minutes, and …

Member Avatar for dreslough
0
2K
Member Avatar for kalyan_1

Could some one help me out with the basics of Structures ? How to use them in C programs ? etc.. Thanx in advance.

Member Avatar for David W
0
131
Member Avatar for nitin1

hi, Can anyone suggest me the approach for finding the lcm of the n numbers? my approach: find the max of the n numbers and start dividing it by all numbers , if all are dividing it then print it, else take next multiple of the max number and repaet …

Member Avatar for ShapesInClouds
0
3K
Member Avatar for Tinnin

Hi all, I've bought the book "Objective-C Programming - The Big Nerd Ranch Guide" and I'm running through the beginning chapters which just regard C. I'm doing this on my laptop running linux as I don't have a Mac (yet). I'm having trouble with this code: #import <stdio.h> #include <readline/readline.h> …

Member Avatar for Tinnin
0
2K
Member Avatar for coding101

I need to create a scenario where all 65535 ports are open. I currently can open 1021 socket desciptors and bind to 1021 ports. If i spawn ~ 70 processes todo the same, i can achieve the goal, but performance is slow. I'm not interested in packet sniffing. How can …

0
76
Member Avatar for nyt1972

Hello, Hope this is the right place to post, I am a student and want to create an OS like DOS just for practice, I know functions, arrays, pinters, structures and file handling but dont know how to start writing an OS, please help me. Regards.

Member Avatar for imawesome511
0
4K
Member Avatar for kalyan_1

Having trouble understanding pointers . Could anyone please help me out ? thanx in advance.

Member Avatar for David W
0
131
Member Avatar for ajit.nayak

I am trying to create Menu Selection process.if SELECT button pressed once should display the Display parameter and if select button pressed twice should goes to Set_parameter window(Where we set parameter). once it is display parameter using up and down arrow Choose the Display window .But problem i am facing …

Member Avatar for Banfa
0
163
Member Avatar for vibhu mishra

i have a c code for printing all permutation of string. I have a problem in understanding ,how recursion work in for loop and how backtracking is used in this code. Another question is that how stack work in recursion under for loop. my code--> # include <stdio.h> void swap …

Member Avatar for David W
0
451
Member Avatar for begueradj

Hello I have downloaded a source code written in C. There I found a Makefile file . Can you tell me how to run that "makefile" file from command line ? thank you

Member Avatar for biswajit.jgec
0
747
Member Avatar for churchill.omorere

Design a C program to convert a decimal number to equivalent 8-bit binary number. Include code that will ensure that the input number is valid, i.e. that numbers 0 to 255 only are accepted. For example, the table below illustrates the process of converting the Decimal number 14 to equivalent …

Member Avatar for deceptikon
-1
110
Member Avatar for niyasc

hei May I know how to handle dev cpp; It shows error even for simple programs which I had successfully run in turbo c 3.0

Member Avatar for Ancient Dragon
0
339
Member Avatar for b.moattar

a program to play Rush Hour. the board is supposed to look like this: -------- |GG...Y| |P..B.Y| |PRRB.Y> |P..B..| |O...TT| |O.FFF.| -------- then You may assume the user enters either upper-case or lower-case input, with or without intervening spaces. and The program ends when the red car touches the '>' …

Member Avatar for rubberman
0
255
Member Avatar for Kevin_7

I'm having trouble compiling a short amount of code to the "Hello World" programming and am needing assistance. This is the error message that I get: no input files C:\Dev-Cpp\My World\Makefile.win [Build Error] n\make.exe: *** ["Hello] Error 1

Member Avatar for Ancient Dragon
0
222
Member Avatar for tharindu123

#include<iostream.h> #include<conio.h> #include<dos.h> void main() #include<iostream.h> #include<conio.h> #include<dos.h> void main() { clrscr(); char un[4]="123",pw[4]="123",unn[3],upw[3]; for(int x=2;x<=79;x++) { gotoxy(x,2);cout<<"Û"; gotoxy(x,24);cout<<"Û"; } for(int y=2;y<=24;y++) { gotoxy(2,y);cout<<"Û"; gotoxy(79,y);cout<<"Û"; } gotoxy(5,3);cout<<"fly aboard system"; gotoxy(3,4);cout<<"username";cin>>unn; gotoxy(3,5);cout<<"password";cin>>upw; if(un[3]==unn[3] && pw[3]==upw[3]) { for(int a=1;a<30;a++) { delay(100); sound(555); cout<<"Û"; } nosound(); } else { gotoxy(3,6);cout<<"wrong"; } getch(); }

Member Avatar for Ancient Dragon
-1
147
Member Avatar for ReaseySo

#include <stdio.h> Reverse Number In C Program int main() { int n, reverse = 0; printf("Enter a number to reverse\n"); scanf("%d",&n); while (n != 0) { reverse = reverse * 10; reverse = reverse + n%10; n = n/10; } printf("Reverse of entered number is = %d\n", reverse); return 0; …

Member Avatar for jnawrocki
0
473
Member Avatar for amzz

I have created a class with few public and private functions to create an sqlite database and related operations.consists of 2 private member variables **A & B**. **Public functions:** to check whether database exists ,if exists open and read data A & B else call the 3 functions from private. …

Member Avatar for amzz
0
861
Member Avatar for rocky2008

clrscr() is usually given after the declaration of all variables. If it is given before the declaration(of variables), the compiler points out an error. Why is this due to ? Will there be any problem in allocating the required amount of memory if at all clrscr() is given before the …

Member Avatar for Ancient Dragon
0
935
Member Avatar for Amir_6

Hi, I'm developing a software in C++/Qt5 and I would like to create a button, which when u click on it, a "status" is posted on the user own wall. So I created a facebook app on https://developers.facebook.com/ but I don't know how to configure it. Also I tried to …

Member Avatar for Amir_6
0
435
Member Avatar for kent.johnstone_1
Member Avatar for rubberman
0
278
Member Avatar for ahmedsalem

Now after learning some C -not so perfect- I want to know how to give my program some style like a button a background image ....etc I want to turn it into a real program with colors mouse interface and other things

Member Avatar for Ancient Dragon
0
58
Member Avatar for aaron.richards.9404
Member Avatar for awais ch

How i take a full expration from user as input in c++ programme like (2+7 or 7*8 )

Member Avatar for Banfa
0
51
Member Avatar for V3N0M

Hi everyone so I have started learning strings in c and I get a problem. I have been changing initialized strings to uppercase or lower case and its easy. But I am having some trouble changing user input to uppercase. Here is a simple program which will take user input …

Member Avatar for Ancient Dragon
0
180
Member Avatar for deven (emile)
Member Avatar for bogoreh

hi dear fellow i have tried to add structure array in my program and i had a few issue to add. please can anyone tell me how can i add a structure array in the following program #include <stdio.h> #include <stdlib.h> #include<string.h> #include<conio.h> struct books{ char name[22], book[25],date1[10], date2[10],id[7],bid[7]; } …

Member Avatar for bogoreh
0
282
Member Avatar for harshchandra

This program just demonstrate how a node can be added,deleted,searched,counted,and printed using Singly Linked List. An easy code to understand :)[code]////////////////////////////////////////////////////////////// ////////// -: Singly Link list :- ///////// //////////////////////////////////////////////////////////// /* reference : Understandng pointer though c - Y karnetkar. */ ////////////////////////////////////////////////////////// ////////// Programmer : Harsh chandra /////////// //////////////////////////////////////////////////////// # include<stdio.h> …

Member Avatar for hanumant113
1
825
Member Avatar for boomboombugsh

How do I show this output using for loop statement? 1 23 345 4567 Thanks in advance :)

Member Avatar for iqra liaquat
0
225
Member Avatar for haroon.khaliq

A computer program intended to be developed which allow creating,reading,updating and deleting student data,one student data comprises of the name,roll numbers and their grades. the version of this application should use text files to store the student data,the arrays structures should be used, this is the code i am trying …

Member Avatar for rubberman
0
154
Member Avatar for V3N0M

Hi I am learning strings in c. And I stumbled on this errors on Xcode. What I am doing wrong? #include <stdio.h> #include <string.h> int main(int argc, const char * argv[]) { char *colors[3][10] = {'\0'}; printf("\nEnter 3 colors separated by spaces: "); scanf("%s %s %s", colors[0], colors[1], colors[2]); //error: …

Member Avatar for V3N0M
0
121
Member Avatar for Rahul47

Hi guys, here is my code for sizeof() problem. #include<stdio.h> struct student{ char name[30]; int roll_no; float marks; }; int main(){ struct student s; printf("\nSize of Name: %d Bytes.", sizeof(s.name)); printf("\nSize of Roll No: %d Bytes.", sizeof(s.roll_no)); printf("\nSize of Marks: %d Bytes.", sizeof(s.marks)); printf("\nSize of S Total: %d Bytes.", sizeof(s)); …

Member Avatar for ddanbe
0
214
Member Avatar for seo2005

Hi, I would like to print the table of a number entered by the user like 2 *1=2 2*2=4 2*3=6 The code is [code=c]#include<stdio.h> #include<conio.h> main() { int i,num; printf("Enter any number"); scanf("%d",&num); for(i=1;i<=num;i++) printf("%d*%d=%d",num,i,num*i); getch(); }[/code] But this code is generating errors.

Member Avatar for Nehal512
0
683
Member Avatar for V3N0M

Hi there y'all I have written a simple program that lets you roll a dice. So in one way I am passing this and in another I would like anyone capable of finding a bug, or check my code if I could have used less lines of code or Tell …

Member Avatar for ddanbe
0
154
Member Avatar for Rahul47

Hello folks, here is my code with question in it. #include<stdio.h> int main(){ float c=10.0001; char *p; p=(char *)&c; // Casting is correctly done. What exactly is purpose of (char *) ? printf("%f", *p); getch(); return 0; } OUTPUT: ![7d924474e7b33ad0974a971ebce23576](/attachments/small/4/7d924474e7b33ad0974a971ebce23576.jpg "align-right")

Member Avatar for ddanbe
0
168
Member Avatar for Rahul47

Hi guys, here is my code that am working on this morning, and I came across a point when pointer operation went wrong. #include<stdio.h> int main(){ char a[20]="Hello World !!!"; char *ptr=a; FILE *p; p=fopen("new.txt", "w"); int i; for (i=0; *ptr != '\0'; i++){ fprintf(p,"%c", ptr[i]); } fclose(p); getch(); return …

Member Avatar for Rahul47
0
190
Member Avatar for Dri Tan

#include <stdio.h> #include <stdlib.h> #include <stdio.h> #inculde <stdlib.h> typedef struct elementi{ int data; typedef struct *next; }lista; lista*putel(lista *l,int x){ lista*tmp; tmp=new elementi; //How can i put a new element? tmp->data=x; tmp->next=l; tmp=l; } . . . (continue)

Member Avatar for Ancient Dragon
0
56
Member Avatar for Iurie

HI ALL, I am trying to sketch the beging of function and the end, #include<ctype.h> #include<graphics.h> #include<conio.h> #include<math.h> #include<dos.h> #include<stdio.h> #include<stdlib.h> int xmax =1024;// getmaxx(); int ymax =760;// getmaxy(); float r,h;//??? int i; void grafica(){ //int gd=DETECT, gm; //initgraph(&gd, &gm, "..\bgi" ); initwindow(xmax,ymax, " Miscare "); setcolor(15); } float f(float …

Member Avatar for Iurie
0
224
Member Avatar for V3N0M

Hi everyone I would like to ask if the code below can me modified to a 3x3 array if not I am ok with that too. The variable is board[3][3]; #include <stdio.h> #include <stdlib.h> /************************************ function prototype ***********************************/ void displayBoard(); int verifySelection(int, int); void checkForWin(); /************************ gloobal variables ***********************/ char …

Member Avatar for Suzie999
0
151
Member Avatar for himanshusharma

I wrote a simple prog. for drawing a circle . Compiled it .. n THERE WAS NO ERROR. But at the Execution time Error Occured : BGI ERROR: Graphics not intialized use 'initgraph I used initgraph olready . [B]1.[/B]Then i copied EVAVGA.BGI from BGI to BIN.. i tried again .. …

Member Avatar for RAHULtripathi86
0
334
Member Avatar for 2014learner

I currently have five resx files in a XAML and C# application. I would like to convert the .resx files into their own resource dictionary. How do I do that by what code or website to look at? In the App.Xaml, xaml, and C# what is the process?

Member Avatar for ddanbe
0
149
Member Avatar for ifeanyiben

The End.