19,876 Topics
![]() | |
(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. … | |
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. … | |
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> … | |
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. | |
(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 … | |
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 … | |
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. | |
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 … | |
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; … | |
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 … | |
Could some one help me out with the basics of Structures ? How to use them in C programs ? etc.. Thanx in advance. | |
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 … | |
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> … | |
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 … | |
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. | |
Having trouble understanding pointers . Could anyone please help me out ? thanx in advance. | |
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 … | |
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 … | |
![]() | 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 |
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 … | |
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 | |
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 '>' … | |
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 | |
#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(); } | |
#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; … | |
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. … | |
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 … | |
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 … | |
in the code const char* buf what is the constant? The pointer or buf? | |
![]() | 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 |
Coding for C++ program to search a given element in a circular queue | |
How i take a full expration from user as input in c++ programme like (2+7 or 7*8 ) | |
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 … | |
i wanted to know programing structure for prime and composit to n num | |
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]; } … | |
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> … | |
How do I show this output using for loop statement? 1 23 345 4567 Thanks in advance :) | |
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 … | |
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: … | |
![]() | 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)); … |
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. | |
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 … | |
![]() | 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:  |
![]() | 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 … ![]() |
#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) | |
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 … | |
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 … | |
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 .. … | |
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? | |
The End.