Forum: C++ 32 Days Ago |
| Replies: 8 Views: 208 Before worrying about big things please pay some attention towards small things...
There is a lot of difference between 1 and '1' .
The input you are taking is a character so the cases of switch... |
Forum: C++ 33 Days Ago |
| Replies: 6 Views: 232 OK here it goes.The piece of code provided by you works on the character buffer from which "cin" reads from, rather than the actual number 42.
Take the example of input of number 10.
It is... |
Forum: C++ 33 Days Ago |
| Replies: 2 Views: 185 Idea for the topic Yes...Code a simple software for a shop or something.It involves file handling as you need to use them for information write and fetch operations.
And a complete no for the... |
Forum: C++ 33 Days Ago |
| Replies: 1 Views: 153 No you will not have the program code. Such programs are called QUINES if you want the program,read about them and then write.
We are not a bunch of jobless people waiting to code for free. |
Forum: C++ 33 Days Ago |
| Replies: 6 Views: 232 First thing who told you to take it as a character...??? You just want to stop on 42 right take it as a integer and compare. |
Forum: C++ 33 Days Ago |
| Replies: 4 Views: 183 Ok so you incremented the pointer C after the second if statement...??? Good now it points to the '\0' if it is in the language.
Now in your code you are just returning the control and not the... |
Forum: C++ 33 Days Ago |
| Replies: 10 Views: 1,952 Sorry about the reply... I didn't see it was a 6 month old thread resurrected... just answered it... ;) |
Forum: C++ 33 Days Ago |
| Replies: 10 Views: 1,952 Your code snippet can be shortened tux...here it goes:
void reverse(char p[])
{
int len=strlen(p);
for(int i=len-1, j=0;j<i; i--, j++)
{
// exchange elements
... |
Forum: C 33 Days Ago |
| Replies: 12 Views: 447 Well what I meant was something like this :
#include<stdio.h>
int main()
{
printf("%d%d",printf("Hello Daniweb"),printf("I am new here"));
return 0;
} |
Forum: C++ 33 Days Ago |
| Replies: 2 Views: 125 @dangutdavid and Phil++ :
Both of you need to understand your basics well because without it you cant code anything.
Error 1 : Line 7 : Initializing A even before declaring it.
Error 2 : Line... |
Forum: C++ 33 Days Ago |
| Replies: 4 Views: 214 This OP deserves an applaud, he is so honest that he is directly giving us his assignment copy and asking us directly to code for him. :D
Really sorry,here your honesty doesn't pay you the code... |
Forum: C++ 33 Days Ago |
| Replies: 4 Views: 183 There are several problems and it starts from main() only.
1)
char *c;
*c = line [0];
Assigning a character value to an address which doesn't point to any memory.
According to your code this... |
Forum: C++ 33 Days Ago |
| Replies: 14 Views: 506 Have you by chance come across the phrase called "Compiling The Program" ??? I can definitely say that you haven't even compiled the program.
Because you have missed out on the very basic of which... |
Forum: C++ 34 Days Ago |
| Replies: 12 Views: 412 1)if(input=="A" && input=="a")
//Same applies to all other vowel statements also
2)a=a++;
//Same applies to all other vowel statements also
The two most foolish statements in your code are the... |
Forum: C++ 34 Days Ago |
| Replies: 12 Views: 412 You have a very wrong impression about DANIWEB and the culture here... We don't say "No Home Work" we say "We wont help until you put in some effort",and even you would agree that we are not wrong.
... |
Forum: C++ 34 Days Ago |
| Replies: 1 Views: 149 Why did you post the code here...??? |
Forum: C++ 34 Days Ago |
| Replies: 12 Views: 412 You need to pay more attention in your classes.Very silly mistakes.
1)
vowels::vowels ()
{
int a=0; int e=0; int i=0; int o=0; int u=0; int y=0;input="";
}
Class functions are used to... |
Forum: C++ 34 Days Ago |
| Replies: 6 Views: 204 Your customers function is a total mess.
Apart from the errors mentioned by Ancient Dragon and jonsca above I felt these were wrong.
1) The criteria should be matched with a previously... |
Forum: C 34 Days Ago |
| Replies: 12 Views: 447 May be a printf within a printf would do the trick.Because the inner printf doesn't require the semicolon. |
Forum: C++ 34 Days Ago |
| Replies: 1 Views: 144 Ok code it... Conceptually everything is right. |
Forum: C++ 34 Days Ago |
| Replies: 2 Views: 163 These are the steps:
1)First write a program to dynamically allocate memory for a matrix,input values to it and print them.
2)Now take a pen and paper and find the inverse of that matrix step by... |
Forum: C++ 34 Days Ago |
| Replies: 2 Views: 193 Here is your faulty code :
for(;k%5==0;)
y++;
k++;
Your k%5 checks if its value is 0 until its not zero k++ executes very well.Once k becomes a multiple of 5 then the... |
Forum: C++ Oct 17th, 2009 |
| Replies: 4 Views: 212 Definitely no need of looping required.Its a simple four step procedure.
1 ) Read the entire line into the character array say str.
2 ) Check if string length of str is greater than 22 or not.
3... |
Forum: C++ Oct 17th, 2009 |
| Replies: 14 Views: 506 @somaja : Ya ya you have caught our attention , now can you please stop using the BOLD RED COLOURED text...??? And ya use code tags (http://www.daniweb.com/forums/misc-explaincode.html) when posting... |
Forum: C++ Oct 17th, 2009 |
| Replies: 4 Views: 269 Post by jonsca and tux4life have divulged all the information related to this topic.But would like to add some from my side.
Apart from the printable characters (character which can be seen on a... |
Forum: C++ Oct 17th, 2009 |
| Replies: 17 Views: 420 Today is your last chance so you please try... |
Forum: C++ Oct 17th, 2009 |
| Replies: 3 Views: 280 Here we show the path for you to follow,but don't code for you. When I gave you the C implementation of the code I thought you will keep it as a guideline and hence implement it in C++ in your own... |
Forum: C++ Oct 16th, 2009 |
| Replies: 13 Views: 352 Use the class concepts (http://www.cplusplus.com/doc/tutorial/classes/) and use objects hence you will make it object oriented.
After using classes you can use inheritance concepts.
If you... |
Forum: C++ Oct 16th, 2009 |
| Replies: 3 Views: 175 Ya lots of ideas... but cant express it until you show your code... |
Forum: C++ Oct 16th, 2009 |
| Replies: 9 Views: 215 Ya once you feel your objective is served then close the thread, so that others can concentrate on other threads.
Read the forum rules on using the code tags.And you can also vote posts and persons... |
Forum: C++ Oct 16th, 2009 |
| Replies: 9 Views: 311 @Tom Gunn : ;)
What you say is definitely one view of the code,I agree. But any language has its essence in its implementation rather than the headers it uses.
Op's code has declared... |
Forum: C++ Oct 16th, 2009 |
| Replies: 3 Views: 280 Never done it before ? Very good try it now !!! Only then you will learn...
Well in C you would do something like :
FILE *f;
char str[100],*str1="file",*str2=".txt";
//You have count and... |
Forum: C++ Oct 16th, 2009 |
| Replies: 9 Views: 215 You don't need to use the reference variables at all as
char calculateGrade(int& avrg, char& grade)
This is enough :
char calculateGrade(int avrg)
{
char grade;
//After this same function... |
Forum: C++ Oct 16th, 2009 |
| Replies: 9 Views: 311 There is nothing C++ in this code apart from "using namespace std","cout","bool".
You aren't using the isnum function at all as its not used in any decision statements even when it returns true... |
Forum: C++ Oct 16th, 2009 |
| Replies: 4 Views: 216 You are using integers to store the factorial of a number and obviously 13! 14! 15! will go out of integer range. It definitely overflows and that is the reason you are getting erroneous outputs. try... |
Forum: C++ Oct 16th, 2009 |
| Replies: 9 Views: 215 @sparksterz : No you should not use system("pause") to view the output.It has been discussed here a lot number of times. You can use cin.get() instead and it too will work in the same way.
@yuha :... |
Forum: C++ Oct 16th, 2009 |
| Replies: 4 Views: 259 Lots of problems only in pointers.
1) Yes you guessed it right the declarations should be of form <function>(char *) format.
2) Consider the following example:
void function(char *a)
{
... |
Forum: C++ Oct 16th, 2009 |
| Replies: 13 Views: 352 Is that so...??? I didn't know it... Thought he too is one among those guys who post their requirements and ask us to code... ;) |
Forum: C++ Oct 16th, 2009 |
| Replies: 12 Views: 4,030 Its no coding secret or something but a simple formula kind of thing here it is :
For two numbers:
max( a , b ) = ( a + b + abs( a - b ) ) / 2
For three numbers it is:
max( a , b , c ) =... |
Forum: C++ Oct 16th, 2009 |
| Replies: 1 Views: 131 Ya Sure...
Our Assignment Delivery Boy will come over to your house in another 30 minutes and deliver you the assignment along with the free things which we have offered.Please pay him the... |