19,876 Topics

Member Avatar for
Member Avatar for SCass2010

Hi everyone, I'm trying to learn C++ and about pointers and whatnot and seem to be a bit stuck... one of the exercises we were given involves passing an object (a Driver object) by reference to another object (a Manufacturer), which stores it. The Manufacturer object can then "employ" and …

Member Avatar for NathanOliver
0
139
Member Avatar for siddiqui_1985

Hi Everyone!! I have a little problem in printing Character Arrays.... i have enclosed my code below. what problem actually i have is that when i type my first name and after first name (space bar) last name.. it prints only my first name. i want to type whole name …

Member Avatar for HASHMI007
0
160
Member Avatar for tubby123

Guys, ok after trying around stuff, I get that this is the way you initialize a structure in C. [CODE]#include<stdio.h> #include<conio.h> typedef struct s { int data; char gender; }st; st s1={5,'a'}; int main(void) { printf("%d "%c",s1.data,s1.gender); getch(); return 0; } [/CODE] But suppose i make a new instance of …

Member Avatar for Narue
0
89
Member Avatar for tubby123

I have this really weird doubt in extern usage Consider the code [CODE] #include<stdio.h> int main(void) { extern int a; printf("%d",a); getch(); return 0; } int a=20;[/CODE] How is it that this code gives the output as 20 ??? My guess Since its an extern variable, it can be declared …

Member Avatar for Narue
0
94
Member Avatar for MarounMaroun

Hello, I'm trying to read lines from a file and strtok it into a double array to work with the numbers. The numbers are separated by ',' and I'm trying to fill array (line[]) with these numbers. This is part of the code. [code=c] while(1) { //we will scan all …

Member Avatar for Ancient Dragon
0
128
Member Avatar for D33wakar

[CODE] #include <stdio.h> float pows(float,float); int main() { float num,base; printf("enter base followed by power integer."); scanf("%f %f",&base,&num); printf("%f ",pows(base,num)); return 0; } float pows(float base,float n) { if(n==0) return(1); else if(base==0) return(0); else for(;n>=1;n--) { return(base*pows(base,n-1));/*recursive*/ } } [/CODE]

Member Avatar for D33wakar
0
151
Member Avatar for Towmator

Howdy! So I'm taking this online intro to C class and have not been able to get in touch with my instructor because I think he's on vacation.Grrrrr. Anyway, If someone could give me some hints on what is wrong with this code I would really appreciate it. I am …

Member Avatar for WaltP
0
113
Member Avatar for logicmonster

I'm having a problem parsing information stored in the buffer after a getline command. I have a file with data in the format: [ICODE]1310 76102 C 5 27 2011 6 26 2011 5 R R 8.00 20.00 F R 8.00 25.00 150 165[/ICODE] I would separate everything using white space …

Member Avatar for WaltP
0
150
Member Avatar for logicmonster

I'm trying to figure out a way to create a loop to open files and read in data until either there are no more files or the user wants to stop. for example, the first time through the loop, the string variable would be "myfile_1" and then each subsequent time …

Member Avatar for logicmonster
0
462
Member Avatar for sydsine

how to addres sparse matrix n*n dimension when stored in a single dimensional array.

Member Avatar for sydsine
0
103
Member Avatar for kooletz

Please help me on my bloodshed 9.4.4.2 assignment, i need to create a program that will view the name and salary. i already created 1 program but in converting Km to mile and the time of the destination when reach.. here are i need to input and to be an …

Member Avatar for YAMNA MIDHAT
0
149
Member Avatar for theCompiler

im creating a simple game and i want it to have continous 10 rounds . but i dont have any idea , im not allowed to use looping .tnx

Member Avatar for sergent
0
290
Member Avatar for raj.sokkalingam

I am a new learner of c. I am trying to code a car game .I have some problems in it . In this,the car is moving separately according to the input .The random cars are generated.I am not able to combine both the functions simultaneously. could any one help …

Member Avatar for sergent
0
156
Member Avatar for Eternal49

Im working on a program and one of the functions writes data to a socket. Everything is working except one part that Im having trouble figuring out. If I create a variable and assign a hex value to it inside the program everything works. (e.g. char variable[] = '\xff\xff\xff\xff\xff'). But …

Member Avatar for WaltP
0
601
Member Avatar for l3l4c7_h4t

hello I want create game server in my City which can many people play at the same time, but not only one game, there can n games running. i want to create 2 programs: [LIST=1] [*]for Clients (players) [*]for server (game server) [/LIST] So when someone would like to start …

Member Avatar for kvprajapati
0
278
Member Avatar for wildplace

i used one register in my inline asm. when i compare the asm codes with and without clobber, i dont see any different between them. so, what exactly does clobber do?

Member Avatar for thines01
0
104
Member Avatar for ZIA_JAPPA125

Hello everyone this is the correct ans for your problem....this program is working propely but but int thing is that i can't solve is that the decimal number range between 1 to 7. if any character in my number will increase from 7 thou it shuold give output the number …

Member Avatar for Adak
0
140
Member Avatar for Falcon143

Hi friends, Please suggest me how to display the line number in C program. without using predefined macros, or windows library files.

Member Avatar for nmaillet
0
2K
Member Avatar for fashxfreak
Member Avatar for prit005
1
104
Member Avatar for thecoolman5

hi, i am trying to make a weight watchers program and heres my code: [CODE]#include<iostream> #include<fstream> #include<conio.h> #include<cstdio> #include<windows.h> using namespace std; int main (char argc) { for(;;) { system("cls"); ifstream r; r.open("cdaily.txt"); double r1; r >> r1; r.close(); ifstream r2; r2.open("cweekly.txt"); double r3; r2 >> r3; r2.close(); cout << …

Member Avatar for VernonDozier
0
267
Member Avatar for danieldane

Hello there, My teacher in programming require to make a phone book style using C language and I almost done this project and I trying to sort up some minor problems. Would somebody our there help me? (please try to run this program by your own to see what I …

Member Avatar for rubberman
0
203
Member Avatar for bhavna04

guys...i m trying to make a simple program to input 3 nos n print their all combinations(......plz help!!!.... thanx...:)

Member Avatar for bhavna04
0
78
Member Avatar for gman1991

[CODE]// this is program designed to create Cd data base #include <stdio.h> #include <string.h> #include <stdlib.h> //============================================= //LINKED LIST USED FOR CREATING THE DATABASE CD //============================================= struct CD_type_node { int CDnum; char title[20]; int CDcount; struct CD_type_node* next; }; struct Artist_type_node // to create a linked list of CD's { …

Member Avatar for WaltP
0
124
Member Avatar for poojavit

I want information on how to start basics of image processing through C language.

Member Avatar for Adak
-1
119
Member Avatar for emmas4impact

Hello, I am writing an application which i need to use the date function and i dont know how to implement it. I wanted the date to be ask from user and be stored in a text file. anyone with hints i can really use some help. Thanks.

Member Avatar for Narue
0
152
Member Avatar for keshvari

Hello I am trying to write a matrix calculator but I have some problems.I use cofactor method for calculation.If you don't know the this method you can learn it here easily: [URL="http://paulbourke.net/miscellaneous/determinant/"]http://paulbourke.net/miscellaneous/determinant/[/URL] I use two function 1- GetMinor() 2- matrixCofactor() that the first one give me the minor matrix and …

Member Avatar for keshvari
0
1K
Member Avatar for shbk

does anybody know library for c/c++ to catch pressing of keys like ctrl+shift+foo or fn+f7 etc. ?

Member Avatar for iamthwee
0
94
Member Avatar for Prankmore

I am trying to take a user input phone number and perform calculations on it as an integer of type long long. I've tried this but it only reads the first 3 numbers then when it reaches the hyphen it stops. [CODE=C] printf("Enter Number: \n"); //get input from user count …

Member Avatar for Prankmore
0
3K
Member Avatar for kiranbhatter

Hi, As I want in my program to enable dynamic vertical scroll bar, i would like to use WM_VSCROLL inside WM_PAINT. Let me explain my situation. As soon as the user hits any key. On output window i am displaying as "key pressed <key>" and then i m moving to …

0
87
Member Avatar for menonnik

How can we find a sub array in a 1-D array? Is there any other method other than brute force method? It is not for maximum sum so we can't use kadane's algorithm.

Member Avatar for menonnik
0
241
Member Avatar for Nicko_FaTe_

Hi i have a task to stores marks for students, a struct is used to store this. the thing giving me trouble at the moment is how to read and store a floating point number within a struct, the data specifically for the mark is on 1 line of a …

Member Avatar for Nicko_FaTe_
0
163
Member Avatar for keevin

Write a global function called format, which formats numbers with a given number of decimal places. The function accepts a compulsory first argument of type double (the number to be formatted) and a second optional argument of type integer (the number of decimal places) and returns a string object containing …

Member Avatar for basrikul
0
436
Member Avatar for theCompiler

i dont know how to random select a word in c . a big help is highly appreciated .. tnx :) for example the words are Ana,Lorie and Denise . how to random select from those words ?

Member Avatar for theCompiler
0
177
Member Avatar for emmas4impact

I have a customer record which i wish to modify so i wrote the following to modify it but each time i typed the name i want to modify it will not modify and prints not found! [CODE]void modify(){ char another='y',choice,name[25],flag='n'; long id; do { //clrscr(); //rewind(fc); printf("SEARCH BY NAME …

Member Avatar for WaltP
0
132
Member Avatar for apanimesh061

How can one demonstrate Multiprogramming and Idle loop in C ??? Please help !!! I can't think any way ..... :?: Thanks

Member Avatar for Narue
0
222
Member Avatar for tubby123

Guys, this is the code from KnR I dont understand this line nunits = (nbytes+sizeof(Header)-1)/sizeof(header) + 1; The entire code is as follows [CODE]static Header base; /* empty list to get started */ static Header *freep = NULL; /* start of free list */ /* malloc: general-purpose storage allocator */ …

Member Avatar for rubberman
0
132
Member Avatar for shanki himanshu

the question of the program i have posted... There are N numbers a[0],a[1]..a[N - 1]. Initally all are 0. You have to perform two types of operations : 1) Increase the numbers between indices A and B by 1. This is represented by the command "0 A B" 2) Answer …

Member Avatar for shanki himanshu
0
181
Member Avatar for c#bird

Hi, I am writing a web app using C# and asp.net. The requirement is that: there is a button "browse" on the webform, when user click it, the folders on the server will be showed. after user select one folder, the fullpath of this folder will be returned. There is …

Member Avatar for rv2011
0
1K
Member Avatar for algotycoon

Hi all I want to make character pascal using strings in c just like SOFTWARE S SO SOF SOFT SOFTW SOFTWA SOFTWAR SOFTWARE plz help me how to make this type of ????

Member Avatar for Muralidharan.E
-3
145
Member Avatar for missil9

Hello. I have been kicking myself for a while now and I was wondering if anyone could please help me. My code is: [CODE]char fname[FNAME_LEN] = "blah" FILE * fp = fopen(fname, "r"); char line[BUF_LEN]; while( fscanf(fp, "%s", line) != EOF ) { double x = atof(strtok(line, "|") ); unsigned …

Member Avatar for missil9
0
304
Member Avatar for emmas4impact

[CODE]void Addcostumer(){ struct CustomerData *p; char another ='y'; char anothers ='n'; CustomerData *newcous; char str1[80]; char str2[100]; char str3[20]; //fseek(fc,0,SEEK_END); p=(struct CustomerData *)malloc(sizeof(struct CustomerData)); newcous= new CustomerData; printf("Costumer Name:"); fflush(stdin); gets_s(str1); strcpy_s(newcous->CName,str1); printf("Costumer Address:"); fflush(stdin); gets_s(str2); strcpy_s(newcous->Address,str2); printf("Costumer Puhelin:"); fflush(stdin); gets_s(str3); strcpy_s(newcous->Puhelin,str3); if ((fc = fopen("c:\\users\\Emmas4impact\\Documents\\customer.bin", "wb"))==NULL) { printf("Cannot open …

Member Avatar for emmas4impact
0
162
Member Avatar for ©lick

Hi. I have this connection code: [CODE]using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; using System.Net.Sockets; namespace ConnApp { class Program { static void Main(string[] args) { Socket sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint ip = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1234); try { sck.Connect(ip); Console.WriteLine("Connected!"); } catch { Console.WriteLine("Error!"); …

Member Avatar for Momerath
0
259
Member Avatar for nishajain

[CODE]#include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<"Let initial states be 0 0\n"; int Q0,Q1,D0,D1; Q0=0; Q1=0; cout<<Q0<<"\t"<<Q1; int Dff(int clk,int D) { int Q; if((D==0||D==1)&&clk==1) { Q=D; return(Q); } } int NOR(int a,int b) { int out; if(a==0&&b==0) { out=1; return(out); } if(a==1||b==1) { out=0; return(out); } } do { …

Member Avatar for m4ster_r0shi
-1
146
Member Avatar for Prankmore

[CODE]# include<stdio.h> # include<string.h> int main(int argc, char **argv){ char phone[16]; int num = 0; int count = 0; printf("Enter a phone number: "); count = scanf ( "%s%n", phone, num ); memmove(phone + 3, phone + 2, 10); memset(phone + 3, '-', 1); memmove(phone + 7, phone + 6, …

Member Avatar for Prankmore
0
188
Member Avatar for theCompiler

I am confused as to where Am I supposed to assigned a variable . my code goes like this [CODE]char text[]= "FRUITS"; printf("Enter between apple,orange or mango"); gets(text);[/CODE] I want to assign a variable "User_select" to that printf part .

Member Avatar for TrustyTony
0
86
Member Avatar for techie929

Hi, I am trying to print the values in enum. Here is the code: [CODE] #include<stdio.h> int main(int argc , char* argv[]) { char played[] = "This old man, he played "; int i=0; enum days{one,two,three,four,five,six,seven,eight,nine,ten}; enum days d; for(i=0;i<10;i++) { printf("%s %s\n ",played,d); } return 0; } [/CODE] Can …

Member Avatar for Narue
0
119
Member Avatar for theCompiler

how do i determine the winner in a game rock paper scissor ? i have 10 rounds and the one who has 7wins shall be declared as the winner but how am i supposed to do that ? great help is highly appeciated :)

Member Avatar for WaltP
0
125
Member Avatar for Mast3r67

Ok, so this is how things stand now. I've read few books about C++ console programming, C++ console game programming, I'm doing C++ on school and I can say I'm pretty good at it. Now, I'd like to move on the next step, to program in C++ with graphics, sound, …

Member Avatar for mike_2000_17
0
184
Member Avatar for EddyWally

Hi there. I'm writing a simple system to order certain data. Now this is the deal: I have a bunch of files with the following filename structures (stored as strings): 0000[i]_FILENAME.EXT i represents a random number. Now I want to scan whether the file has that structure, and if it …

Member Avatar for EddyWally
0
170
Member Avatar for muktigeek

[CODE]void main() { char a=250; int expr=a+!a+~a+ ++a; printf("%d",a); getch(); }[/CODE] what is output and plz explain it..:):)

Member Avatar for Narue
0
103

The End.