Forum: C Aug 8th, 2004 |
| Replies: 4 Views: 2,963 For reading you use scanf() with format specifier "%f","%g","%e" or printf();
the variable tyoe is float and functions are in math.h
You need functions->read tutorials |
Forum: C Jul 30th, 2004 |
| Replies: 7 Views: 5,113 |
Forum: C Jul 16th, 2004 |
| Replies: 0 Views: 2,184 I want to have a class LIST -- a dinamic list of rational numbers (defined previously in my RATIONAL class). I want another class STACK to inherit LIST's root and end pointers for my list.(STACK also... |
Forum: C++ Jul 14th, 2004 |
| Replies: 7 Views: 17,484 To Valmian: Comunicating functions are like:
class none
{
int x;
public:
int& getx()
{
return x;
}
}; |
Forum: C++ Jul 14th, 2004 |
| Replies: 4 Views: 2,295 How about:
#include <iostream.h>
#include <ctype.h>
#include <conio.h>
void main()
{
cout<<"please enter first name, middle name and last name"<<endl;
cout<<"(max 20 chars each)"<<endl;... |
Forum: C++ Jul 14th, 2004 |
| Replies: 2 Views: 6,944 Well it's obvious you're using some sort of template or something I on't understand. To read text from a file use fgets(char *s,int nrchr,FILE *inpfile);
Since you're using fstream go for:
... |
Forum: C++ Jul 8th, 2004 |
| Replies: 13 Views: 30,139 To Dave: Thanks a lot. I've figured out why it sometimes would work and other times it would crash! When a pointer is declared in main(), it has a residual adress to a memory block. Therefore, it can... |
Forum: Game Development Jul 5th, 2004 |
| Replies: 5 Views: 7,556 I've used them in a Snake game. I don't remember exactly but something like #77... :?: Check the ASCII code. You'll certainl find them there :) |
Forum: C++ Jul 5th, 2004 |
| Replies: 5 Views: 3,042 Hmm how about declaring 2 macros:
#define max(a,b) a>b?a:b
#define min(a,b) a<b?a:b
int max,int min;
...
max=max(x[0],x[1]);
min=min(x[0],x[1]);
for (i=2;i<n;i++)
{ |
Forum: C Jul 5th, 2004 |
| Replies: 10 Views: 4,087 Are you sure? :?:
You will print "number of columns" times "$$". In nufanvandal's first post, I understood that a column is made up of a "$$" and a line is made up of a "$$", "number of... |
Forum: C++ Jul 5th, 2004 |
| Replies: 13 Views: 30,139 TO Asif_NSU:I must admit that in Dev C++ this doesn't work at all. BUT in the DOS version it WORKS very well. I'm using Borlamd C++ 3.1. This thing is highly useful for ME. I will be in the 8th form... |
Forum: C Jul 4th, 2004 |
| Replies: 10 Views: 4,087 ok i've written some code for you. it reads the number of rows and columns and prints the drawing.
#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();
int m,n,i,j;... |
Forum: C++ Jul 3rd, 2004 |
| Replies: 13 Views: 30,139 Do you think it actually matters?!
If you have:
int a=new int[8];
a[0]=23;
delete a;
cout<<a[0]; |
Forum: C Jun 23rd, 2004 |
| Replies: 2 Views: 9,093 Thx. I looked it up in a book.
BTW: Instead of using a vector: int a[100] you could use:
int *a;
a=(int*)malloc(100*sizeof(int)); OR
a=(int*)calloc(100,sizeof(int));
It's kind of... |
Forum: C++ Jun 21st, 2004 |
| Replies: 11 Views: 15,744 ahh ok I see. Thanks Dave :) |
Forum: C++ Jun 20th, 2004 |
| Replies: 11 Views: 15,744 Well, that's what his problem said. Anyway i'm not a US or UK citizen so i'm not great at english :sad: What is a vending machine exactly?! :o |
Forum: C++ Jun 20th, 2004 |
| Replies: 6 Views: 15,606 I know they won't work in Visual C but I'm a Borland C++ (for DOS) user. :!: |
Forum: C Jun 19th, 2004 |
| Replies: 1 Views: 13,249 How exactly do you want to get length?!!
The only way I know of is using <string.h> There is a strlen(char *s) function which return the strings length :D |
Forum: C++ Jun 19th, 2004 |
| Replies: 11 Views: 15,744 Thanks Fire Net :D Do you suppose it's too late for it to be of any use? |
Forum: C++ Jun 19th, 2004 |
| Replies: 11 Views: 15,744 ok... it's ready but it doesn't cover the part where the option is invalid ;)
#include <iostream.h>
#include <conio.h>
int dol,cen;
unsigned int cb=0,ch;
void convert(int cb)
{
... |
Forum: C++ Jun 19th, 2004 |
| Replies: 11 Views: 15,744 I'm writing your program though it might be too late! ;) |
Forum: C Jun 18th, 2004 |
| Replies: 5 Views: 2,535 There is a time structure you know-- see gettime() : :lol: |
Forum: C Jun 18th, 2004 |
| Replies: 2 Views: 9,093 I have a very important question (for me)
How do i use <alloc.h>/<malloc.h>/<stdlib.h> for memory allocation?
i'm talking about: malloc(),calloc(),halloc(),realloc(),alloca(),heapwalk(),free()... |
Forum: C++ Jun 18th, 2004 |
| Replies: 6 Views: 15,606 You're right Fire Net.
The colour list is ok. you know that's why i use printf/scanf
In <conio.h> you may find: cprintf(...);cscanf(...) with the same paramters as ...scanf() and... |
Forum: C++ Jun 18th, 2004 |
| Replies: 4 Views: 3,171 Just asking Blood Night: What does output say?
what does 1n mean 1*n or 1n as a number; what do you mean???
( for all interested my e-mail is yuri@fx.ro-could you send answer here? ) |
Forum: C++ Jun 18th, 2004 |
| Replies: 6 Views: 16,473 It should be answer (b)
Here's an example:
#include <iostream.h>
main()
{
char s[100];
cin.getline(s,100);
cout<<s;
} |
Forum: C++ Jun 18th, 2004 |
| Replies: 14 Views: 5,165 woops i'm from romania. "Numarul de termeni:" means how many elements you will input and "Suma obtinuta" means the sum you have obtained. My mistake! :o |
Forum: C++ Jun 18th, 2004 |
| Replies: 5 Views: 24,703 well if you include main() in a header that would be more like a program than like a header but anyway you can ;) |
Forum: C Jun 17th, 2004 |
| Replies: 15 Views: 4,174 Please give me all the details about your assignment-- exactly what must it do. I'd be more than happy to write a source file :p
Give me your e-mail and i'll send you the program! (it might be... |
Forum: C Jun 17th, 2004 |
| Replies: 14 Views: 33,111 The answer is quite simple:
Just use "<"or">" operators in an "if" instruction like in a normal sorting method for numbers. Be careful though:
if you have:
... |
Forum: C++ Jun 17th, 2004 |
| Replies: 14 Views: 5,165 Red_evolve... i've written a version for Q1 myself and it's pretty similar to yours (mine's a program---in my opinion you understood pretty good)
#include <stdio.h>
#include <conio.h>
long... |
Forum: C++ Jun 17th, 2004 |
| Replies: 5 Views: 24,703 It is very very simple:
write some functions||define some macros||define structures/classes etc...
DO NOT include a main() function
save it with the name you want
e.g... |
Forum: C++ Jun 17th, 2004 |
| Replies: 6 Views: 2,215 Well i'm a teen-ager myself (13). I recomend learning the PASCAL language then go to C. Pascal is far more basic; it doesn't have as many functions as C
BUT it is easier to use :mrgreen: |
Forum: C++ Jun 16th, 2004 |
| Replies: 5 Views: 34,861 Ok--try this (i'm not sure it's perfect...13 yr olds can make mistakes)
#include <stdio.h>
#include <conio.h>
#include <alloc.h>
struct nod
{
int info;
nod *adr;
}; |