Search Results

Showing results 1 to 40 of 44
Search took 0.01 seconds.
Search: Posts Made By: zalezog
Forum: C++ Aug 23rd, 2009
Replies: 7
Views: 362
Posted By zalezog
Did you initialize option? you seem to be commenting //system("pause");.Are you really using a standard compiler?

>>The problem seems to be if I input strings or characters, it crashes

First...
Forum: C++ Aug 17th, 2009
Replies: 9
Views: 627
Posted By zalezog
True.
But the program still wouldn't work
This line

int small, temp;


small (its the index)is Ok but temp stores the value of the element in the double[] input_array, so you will always...
Forum: C++ Aug 17th, 2009
Replies: 8
Views: 810
Posted By zalezog
Binary Search would come into picture only iff you have a sorted input like dell, bell etc and corresponding sorted array to search for. Your examples don't have a sorted string in most of the...
Forum: C++ Aug 15th, 2009
Replies: 13
Views: 623
Posted By zalezog
I didn't want to poke but firstPerson's method doesn't take into account the frequency of characters, so for inputs
like s1 = roorsseett
s2 = sosretetet
returns true.
letter s1 ...
Forum: C++ Aug 14th, 2009
Replies: 14
Views: 428
Posted By zalezog
You haven't said anything about the desired output of your program, the total you were expecting, what testsdid you do , if you ae using compound interest, then the formula looks wrong to me.
...
Forum: C++ Aug 14th, 2009
Replies: 9
Views: 480
Posted By zalezog
I doubt whether this will help..:S , your read_in file remains intact, your read_out now is:

#include <iostream>
#include <string>
using namespace std;
int main()
{
string word;
//...
Forum: C++ Aug 12th, 2009
Replies: 6
Views: 322
Posted By zalezog
double interest = .00575;

I think the monthly interest is given.


double monthlyInterest = interest * 12;
is actually the yearlyInterest which comes to ~ 7 %.

Well, if you are calculating...
Forum: C Aug 7th, 2009
Replies: 4
Views: 378
Posted By zalezog
Well,It also gives me an error.

syntax error before else

every where when you have else statements coming ahead of else if statements.

May be we can alter the structure of the program , if...
Forum: C Aug 2nd, 2009
Replies: 25
Views: 938
Posted By zalezog
hmm, let's C:twisted:

void userInput (int matrix[R_SIZE][C_SIZE], int row, int col) //gathering user input
{
/*You are using a for loop in main().This function just accepts input for a...
Forum: C Jul 29th, 2009
Replies: 5
Views: 331
Posted By zalezog
What if '15' does not exist in the array, what happens then ?
How far will index go ?

or, if there are multiple copies of '15'?
Forum: C Jul 29th, 2009
Replies: 5
Views: 418
Posted By zalezog
Instead of putting the whole thing in main(), why not make one or two different functions for computing the total salary and gross salary.

const int OVERTIME_MULTIPLE = 1.5;
const int...
Forum: C++ Jul 20th, 2009
Replies: 10
Views: 536
Posted By zalezog
Then..



I wouldn't agree.
A snippet which might help you if you can see the link.:twisted:

#include<iostream>
#include<string>
Forum: C++ Jul 19th, 2009
Replies: 10
Views: 536
Posted By zalezog
Another approach could be
1.Make another userGuess string.
2. First , fill all the characters in userGuess string
with underscores( _ ).
3.Make changes in the userGuess string.


guess();...
Forum: C++ Jul 18th, 2009
Replies: 11
Views: 747
Posted By zalezog
//Get lowest
lowest = scores[0];
//Without the for loop code works fine.
//for ( int count = 1; count < numScores; count++)
//{
//if(scores[numScores] < lowest)
// Out of bounds
//array...
Forum: C++ Jun 30th, 2009
Replies: 18
Views: 731
Posted By zalezog
cin would stop reading as soon as it encounters a space !
Use getline instead:

getline (cin , passage)




Instead ,
Forum: C Jun 15th, 2009
Replies: 8
Views: 406
Posted By zalezog
If max is the number of primes ,you originally want then why are you looping to maxprimes (or is it MAXPRIMES)
( @siddhant3s :
)

//while (count < maxprimes)
//shouldn't it be
(count <...
Forum: C Jun 1st, 2009
Replies: 9
Views: 364
Posted By zalezog
The series breaks down to::
1 - 2 / (2 *1) +3 / (3*2!) -....
i.e 1 - 1 + 1/2! - 1/3!
So the first (major) 2 terms of the series cancel out.
Now, may be you define a variable
int sign_carrier =...
Forum: C++ Mar 30th, 2009
Replies: 10
Views: 498
Posted By zalezog
Yes you need to else you work with garbage values.

May be you didn't quite get it,by using an ampersand you actually give the function true memory addresses of

initial, fuel, taxRate

to...
Forum: C++ Mar 30th, 2009
Replies: 10
Views: 498
Posted By zalezog
void displayInstructions (float &initial, float &fuel, float &taxRate)
//there is an ampersand

{


cout << "The following program will display 3 homes." << endl;
cout <<...
Forum: C++ Mar 30th, 2009
Replies: 10
Views: 498
Posted By zalezog
Because you did not initialize your variables
Suppose you change
void displayInstructions ()
as

void displayInstructions (float &initial, float &fuel, float &taxRate)
//and delete this...
Forum: C++ Mar 30th, 2009
Replies: 10
Views: 498
Posted By zalezog
I think in the function

void displayInstructions ()
//You should be passing
//these parameters by reference
//float initial, fuel, taxRate;
//since you seem to use those values in
//...
Forum: C++ Mar 30th, 2009
Replies: 4
Views: 624
Posted By zalezog
that is because int the function
void printForm(char form[][6], int row, char column)
you get into the block only once

if(i == row - 1 && j == static_cast<int>(column)-65)

You don't make...
Forum: C++ Mar 4th, 2009
Replies: 18
Solved: PLS. READ
Views: 677
Posted By zalezog
This would certainly work if all the numbers are distinct,else you 'll get only the last occurrence of that number in the 'loc'
Forum: C++ Feb 23rd, 2009
Replies: 10
Views: 886
Posted By zalezog
Instead use strings.
Forum: C++ Feb 22nd, 2009
Replies: 7
Views: 1,077
Posted By zalezog
Suppose,instead of using

cin.getline(...)//the failbit is set if input
//exceeds max numbercharacters allocated

you manually accept each letter,you can always count the number of characters...
Forum: C++ Feb 21st, 2009
Replies: 4
Views: 775
Posted By zalezog
First,for a a number in an array call it as
int num;


//Your expression for evaluating control variable
//certainly doesn't give all the factors,referring to
//for (int j = 2; j <= floor...
Forum: C++ Feb 21st, 2009
Replies: 7
Views: 1,077
Posted By zalezog
You were displaying all the letters

for (loopCount= 0;loopCount < numLetters;loopCount++)
{ //to display CAPITAL letters
//You enter inside if block only if it is a small letter.
//else...
Forum: C Feb 19th, 2009
Replies: 5
Views: 425
Posted By zalezog
First of all,you must pass your array seat[40] to your function
int askFlight(void); .
Else how will the contents of the original array change?Also in the function definition and prototype,
...
Forum: C Feb 18th, 2009
Replies: 5
Views: 425
Posted By zalezog
You don't loop through your statements to see whether

both the choices work for you



if (choice =2)


If suppose I have booked a ticket,have you placed a 1 in the index position of
Forum: C++ Feb 8th, 2009
Replies: 6
Views: 712
Posted By zalezog
You almost got it right .

char name[5][50];
for(int i=0;i<5;i++)
{
cin.getline(name[i], 50);
}
for(int i=0;i<5;i++)
{
//or cout<<name[i]<<"\n";
Forum: C++ Feb 6th, 2009
Replies: 5
Views: 572
Posted By zalezog
Since you are just finding the prime factors of a number,how about something like this::

//fragment code where num is your real number
if(num>0)
{

for(int i=1;i<=num;++i)
{

...
Forum: C++ Jan 21st, 2009
Replies: 16
Views: 3,368
Posted By zalezog
or

ifstream myfile(file.c_str());
Forum: C++ Jan 21st, 2009
Replies: 16
Views: 3,368
Posted By zalezog
As far as the errors you are encountering,

should be replaced with:

ifstream myfile;
myfile.open(file.c_str());
Forum: C++ Jan 18th, 2009
Replies: 3
Views: 269
Posted By zalezog
Should be something like this::

#include<iostream>//Watch out
using namespace std;

class first
{
public: //Added
int reverse()
{
Forum: C++ Jan 17th, 2009
Replies: 6
Views: 277
Posted By zalezog
Add the line

using namespace std;

after

#include<iostream>

or,use std::cout<<"Test";
Forum: C++ Jan 16th, 2009
Replies: 16
Views: 3,368
Posted By zalezog
That's done Murtan suggested a better way to solve the problem,I got your point and may be we utilize the memory a bit more efficiently this time in our while loop..

//fragment code
while...
Forum: C Jan 16th, 2009
Replies: 6
Views: 565
Posted By zalezog
1. l x=10;
and left shifting the bits once does not give you 0100
but 10100(ie.20)

2.If you want the output to be converted into a binary format
you can try out something like this:
...
Forum: C++ Jan 16th, 2009
Replies: 5
Views: 950
Posted By zalezog
I believe that by placing a break statement you were trying to return back to the main() function.
Placing a

return;//Instead of break might be what you are looking for

The above...
Forum: C++ Jan 16th, 2009
Replies: 16
Views: 3,368
Posted By zalezog
string line;
char str[BUFSIZ];

1. Murtan is absolutely right when he says that declaration of

str[BUFSIZ];
int array_words[10];

should be before the loop where the content of 'str' is...
Forum: C++ Jan 15th, 2009
Replies: 16
Views: 3,368
Posted By zalezog
If you want the whole line to be printed ,then replace every call with..

pch=strtok(str,"\n");


I don't understand,when you say

If you want to store each word in your file(if that's what...
Showing results 1 to 40 of 44

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC