- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
16 Posted Topics
Re: Hey firenet You had mentioned a way to delete a record from the file (using sequential access). I tried to do it with random access (i.e seekg and seekp). The program can't delete the last record. What do I do? :( | |
I don't get why C++ pros see red when they see [B]void[/B] main(). Can someone explain why [B]int[/B]main() is good and [B]void[/B] main() bad? | |
Re: Well, you can try this code, but I don't know if it will work beyond n=9. [CODE] #include <iostream.h> #include <conio.h> /* This program creates a half pyramid of nos. Created on 12.6.2k3. */ void main() { int n, i, r; cout<<"Enter the number of numbers: "; cin>>n; if (n>9) … | |
Re: Chainsaw's code is correct except for one thing, you add j to the sum, not i; #include <iostream.h> #include <conio.h> void main() { int n; cin>>n; int i, j; int sum=0; for (i=1; i<=n; i++) { for (j=1; j<=i; j++) { sum+=j; } } cout<<sum<<'\n'; getch(); } | |
![]() | Re: [QUOTE=Chainsaw] Two easy solutions I can think of here; one is to return how many digits the answer should be and make a string out of the result with leading zeroes (using sprintf(), say). the other is to do the reversal as a string of chars. [/QUOTE] You do have … |
I have a code in which I want to swap an element in a matrix with another. User inputs the row, column no of the elements to be swapped. But the code doesn't seem to work. Can somebody help? PS: The swapping starts in the snigleplayer() function. [CODE]#include <stdio.h> #include … | |
for my project, I need to generate an n*n matrix (n is user input) with numbers from 1 to x (x<n) positioned randomly. I tried implementing it with this code but it doesnt seem to work. x = n*n - number of holes. the number of holes is user input … | |
we have a project in our class to design a sliding numbers game similar to this one: [URL=http://www.eatmygames.com/gameinfo.asp?id=24puzzle]http://www.eatmygames.com/gameinfo.asp?id=24puzzle[/URL] the only difference is that the number of blank spaces is user input (max=n/2 where n: no of elements in a row/column). we have to design an algorithm to make the computer … ![]() | |
I have this project to do and I want to use coloured text and some simple shapes, etc. But the problem is that my compiler does not support graphics.h or dos.h. Even my tclite doesn't (I usually use BC5 windows version). Is there any way of correcting this problem? Or … | |
I have a popup program that seems to have installed itself on my computer. Everytime my internet is idle, it displays search results from some searchmiracle.com. I don't know how it got onto my PC and I don't know how to remove it. Spybot and Google popup blocker don't seem … | |
Re: No comparison! I'm doing both subjects right now. And calculus drives me nuts! I mean its pretty awe-inspiring but it never gets into my head. C++ is a different matter. I thoroughly enjoyed every class of C++ till now. I would give my right arm to understand calculus properly. Btw, … | |
![]() | |
Re: You don't HAVE to define NUM_TURNS as static. Defining it as static makes it common between all objects of that class. So if you have GamePlayer a1; GamePlayer a2; then, a1.NUM_TURNS and a2.NUM_TURNS don't exist, but NUM_TURNS does. | |
Since no one cared to answer my thread posted earlier, :mad: I'm posting the question again. I have this project to do and I want to use coloured text and some simple shapes, etc. But the problem is that my compiler does not support graphics.h or dos.h. Even my tclite … | |
Re: Shalin's method is the ideal one. However, if you don't want to use strcmp() for some reason, there's always a manual, lenghtier way to do it: [CODE]#include <iostream.h> #include <stdio.h> int main() { char pass[12]; char ans[4]="neo"; cout<<"Enter password: "; gets (pass); int flag=1, i; for (i=0; i<4; i++) { … | |
I'm trying to use sequential binary file editing in C++. I use a temporary file. I have to make the changes in the file by storing the modified data in the temp file. Then I delete the original file and rename the temp as the original. The problem is the … |
The End.