- Strength to Increase Rep
- +5
- Strength to Decrease Rep
- -1
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 4
- Downvotes Received
- 26
- Posts with Downvotes
- 16
- Downvoting Members
- 14
|
Re:
#include<stdio.h> int main() { int pcheck=1,i; int k=1000 for(i=2;i<k;i++) { if((k%i)== 0) { pcheck=0; break; } } if(pcheck) { printf("%d is a prime .\n",k); } else { printf("%d is not a prime.\n",k); } return 0; } this code works to check any number i that write in k but when … |
Re:
[CODE]#include <graphics.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> #include<dos.h> int main(void) { int gdriver = DETECT, gmode, errorcode,i; int midx, midy; int radius = 100; initgraph(&gdriver, &gmode, "c:\\tc\\bgi"); errorcode = graphresult(); midx = getmaxx() / 2; midy = getmaxy() / 2; setcolor(getmaxcolor()); for(i=5;i<=90;i+=2) { delay(50); setcolor(i); circle(midx+i, midy-i, radius); setcolor(i); … |
|
Re:
I think the code comments show what is needed. Essentially, I just need to spit out the members name and score who are below the average score in the list. [CODE] void displayLowScore(struct payload *arrayStart , //first element of array struct payload *arrayEnd ) //last element of array { int … |
|
Re:
Are constants, defined by using the keyword const , external linkage or internal linkage? Can constants be modified using pointers? What about constants defined using by #define? |
|
Re:
I need to yourhelp,too. can you write this programm :sum and multy 2 sparsematrix with linklist?(language c++) |
|
What is the difference between using system("pause") and cin.get(pause)? [URL="http://www.daniweb.com/forums/post1446085.html#post1446085"]Oliver [/URL]told me never use system("pause"). [code] #include<string> #include<iostream> int main(){ using namespace std; string str = "My name is shridhar"; cout<<"What is your name"<<str; char pause = 0; cout << "Press enter to continue..."; cin.get(pause); } [/code] |
|
Re:
/*I have to write code for the Game of Life. I wrote nearly all the code for it but for some reason when I run my second generation it just displays the same one as before. Here is my code any idea on why this is happening would be greatly … |
|
Re:
I've been set in a lab session at University the task of creating a program which can perform one of a variety of calculations, with it performing the one specified by the user, and with it looping back after every calculation however it is the looping which is causing me … |
|
Re:
hello im new to linux programming and i am experiencing a bit of diffuclty with pthreads...basically the pthread_create() function in my code below i tend to pass an integer variable as the argument for my runner() function but i get a warning and an error..i have tried several ways of … |
|
Re:
#define print_int(a) printf("%s : %d\n",#a,(a)) int y=10; print_int(y) i am taking a class and have been asked to explain why this is bad... So i guess stringifing #a is the problem. It does work, so why is it dangerous? |
|
Re:
[CODE]/*Simply change the path in initgraph(&gdriver, &gmode, "d:\\TC\\BGI"); e.g if your working directory is E write "E:\\TC\\BGI"*/ #include<graphics.h> #include<stdio.h> #include<conio.h> #include<math.h> #include<dos.h> int main() { float i,k,r; int gdriver = DETECT, gmode,c,j,l=57,m=56; initgraph(&gdriver, &gmode, "d:\\TC\\BGI"); printf("House constructed by Paritosh:"); printf("\nFor the visibility in different colors enter any integer: "); scanf("%d",&c); … |
|
Re:
[CODE]typedef struct electro { char name[20]; int access_number; char address[50]; float balance_due; }; electro account[10]; electro account[0].balance_due=$ 120.52; electro account[0].address[50]={Cane Gardens};[/CODE] Can someone tell em how to correct this piece of code. I'm using Codeblocks and it says it " expected an initializer before '.' " in the two last … |
|
Re:
[CODE]#include<stdio.h> #include<conio.h> #include<graphics.h> #include<dos.h> void main() { int gd=DETECT,gm,year,month,day,cy,cm,cd,i,j,maxx,maxy; int y,m,d; int midx, midy; int stangle = 0, endangle = 360; int xradius = 100, yradius = 50,xradius1 = 2, yradius1 = 2; int radius = 50; clrscr(); initgraph(&gd,&gm,"d:\\tc\\bgi"); maxx=getmaxx(); maxy=getmaxy(); for(i=0;i<10;i++) { setcolor(4); rectangle(i,i,maxx-i,maxy-i); rectangle(9,11+i,629,45-i); } for(i=0;i<315;i++) { delay(3); … |
|
Re:
(Linux)I am trying to use this code: /* *Converts pounds to kilograms. */ #include <studio.h> /* printf, scanf,definitions*/ #define KG_PER_POUND .4536 /*conversion constant */ int main(void) { double pounds, /* input - weight in pounds. */ kg; /*output - weight in kilograms */ /* Get the weight in pounds. */ … |
|
Re:
im doing a college project in c++. it is a token system of bank(line,queue..).it waits for a enter key and then it creates a token with entry time and expected leaving time,cashier to attend to and token no. whenever i compile the program it gives no error but after runing … |
|
Re:
i have written the code and tried to compile, but it always say that the file can't be read, yet i have put the same name file in one directory with the c++ file. need your help so can read the file on my mac.. #include <iostream> #include <fstream> #include … |
|
Re:
Dear Sir, I am trying to print the string with the following code, but I am getting errors like Undefined symbol 'string' Undefined symbol 'str'. [CODE]#include<conio.h> #include<string.h> #include<iostream.h> void main() { string str = "My name is shridhar"; cout<<"What is your name"<<str; getch(); } [/CODE] I think the problem is … |
|
Re:
Consider and ADT list of integers. Write a function that computes the sum of the integers in the list aList. The definition of your function should be independent of the list’s implementation. may i know how to do this type of question? |
|
Re:
if i were to do this in a program, would it possibly overwrite data/memory that is already being using by my application? int main() { char *pointer = "hi"; pointer = "weeeeeeeeeeeeeeeeeeeeeee"; return 0; } |
|
Re:
hi! i want to print a colored 'A' using putchar, let's say green. i am able to print * by doing just putchar('A'); but i don't know that how to print a colored 'A'. i have also tried to write: putchar('A',255); and also putchar('A',3); but no success. |
|
Re:
Hello, How can i create / edit the details that shown in the property -> version tab of an executable file . ie which can be taken from window's explorer mouse right click context of an exe file. The exe file was created using MINGW and qmake. thanks in advance … |
|
I need to calculate the area of a triangle using this formula. What is wrong with my code? error C2063: 'p' : not a function [CODE]#include <stdio.h> void Area(int a, int b, int c) { int p = a * b * c; int area = (p(p - a)(p - … |
|
|
Re:
Hello, I have a dll that I wrote and a driver program to call that dll. Both the programs were written in VC++ 2008 express edition. The program takes in 2 strings as a command line argument and passes it to the dll which prints the 2 strings in the … |
I am trying to print a rectangle using this symbol *. When I print it, it draws an L. What is wrong with my code? [CODE]#include <stdio.h> void rect(int base, int height) { int x = 0,y = 0; while(x < height) { x++; if(x == 1 || x == … |
|
Re:
Hi friends, I have an assignment to put three little programs into one, making each one a function of the main program, which is a kind of menu. The three work perfectly as separate entities, but when I put them together, the thing won't compile. Can anyone tell me what's … |
|
Re:
[CODE]// Cubic conversion of Borwein's Algorithm // Each iteration converges // cubically against 1/pi; // that is, each iteration // approximately triples the // number of correct digits. // Program written by ROBO_HEN5000 // Algorithm complements of Wikipedia. #include <iostream> #include <cmath> using namespace std; int main() { float a; … |
|
Re:
i have written a program in c++ using the concept of file handling. this program is about managing a basic electronic hardware store stock and showing the sales report. i am not able to understand why the [B]contents of my file are not being displayed, modified, deleted, or even printing … |
|
Re:
Hi everyone! I'm reading a book and doing some exercises in this book. One of them is: define a class, which implements arithmetic (+, -, /, *) with arbitrary precision. This is a new type with just some arithmetic operations. With type double we also can do some arithmetic but … |
|
Re:
Dear all, I would like to ask you how to initialize the following: I want to initialize a class inside another class. How I will be able to do so? An example: [CODE]/*Class Date*/ class Date { public: Date(){} // default constructor int day;//day of the month valid till 31 … |