zandiago 115 Nearly a Posting Maven Featured Poster

throat----->choking

zandiago 115 Nearly a Posting Maven Featured Poster

any assistance is appreciated...thx

zandiago 115 Nearly a Posting Maven Featured Poster

Ok guys, thx much for the assistance, problem solved. Time to move on my new assignment. Thx again and have a good day.

zandiago 115 Nearly a Posting Maven Featured Poster

jwenting....i was being sarcastic...but point taken....how about your Ford vs my bycicle...or better yet....ur Ford vs my Spura?...jst joking...but i'm not ready for a bike off the mountains yet...i had enough falls off my bike living in the caribbean.

zandiago 115 Nearly a Posting Maven Featured Poster

A qucik observation: one of the actual answers is : 351...however, 153 isn't listed... Can i just sort the individual values?

zandiago 115 Nearly a Posting Maven Featured Poster

When you say that your background has been 'locked out', please elaborate. Also, you have additional copies of "C:\WINDOWS\system32\svchost.exe". I think that there should only be 2.

zandiago 115 Nearly a Posting Maven Featured Poster

I'm repost my code...section one is kool, however, i get three digit answers....the assignment was to determine which 2, 3, and 4 digit numbers are equal to the sum of the cubes of their digits.

zandiago 115 Nearly a Posting Maven Featured Poster

Oh goodness...never thought about the zeros...because '0000' isn't really used.

zandiago 115 Nearly a Posting Maven Featured Poster
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;

int main ()
{
	int i, j, k, m, digits;
	int number = 0;
	
	for( int i = 1 ; i < 10 ; ++i )
    for( int j = 0 ; j < 10 ; ++j )
    for( int k = 0 ; k < 10 ; ++k )
    for( int m = 0 ; m < 10 ; ++m )
      {
          int number = i*1000 + j*100 + k*10 + m ;
          int digits = i*10 + j + k*10 + m ;
          if( digits * digits == number )
			  cout<<"The # : "<<i<<j<<k<<m<<endl;
      }
	int temp;
	for(int j=1000; j<9999; ++j)
	{
		temp = number +  number;
	
	if ((temp * temp) == j)
	
		cout<<"No such numbers "<<j<<endl;
	}

			
	return 0;
}

Thanks for all the help thus far, the first section of teh assignment works good, just the second section: Section two:
The program continues by determining which 2, 3, and 4 digit numbers are equal to the sum of the cubes of their digits.
Example:
If the original number is 234, determine if 2 cubed (8) + 3 cubed (27) + 4 cubed (64) which is 99 is equal to the original 234.
I made a bit of modifications to what I had and it produced random numbers.

zandiago 115 Nearly a Posting Maven Featured Poster

coffee with milk

1 million dollars (USD) or 1 additional year to your lifespan?

zandiago 115 Nearly a Posting Maven Featured Poster

Oh my goodness...that's carzy....not many cars can do that. Well time for me to head to the alps...

zandiago 115 Nearly a Posting Maven Featured Poster

See it..missed that one...but the answer still outputs on the screen though

zandiago 115 Nearly a Posting Maven Featured Poster

Times New Roman

white or dark chocolate?

zandiago 115 Nearly a Posting Maven Featured Poster

No

Do you think wrestling is fake?

zandiago 115 Nearly a Posting Maven Featured Poster

Also..where I have cout<<"Section 1 numbers "<<j<<endl;...why doesn't that line prints on the screen? The second part doesn't seem to work how I wanit...the first section works ok...but just the second part of the function.

zandiago 115 Nearly a Posting Maven Featured Poster
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;

int main ()
{
	int i, j, k, m, digits;
	int num = 0;
	int sum_cubes = 0;
	int number = 0;
	
	for( int i = 1 ; i < 10 ; ++i )
    for( int j = 0 ; j < 10 ; ++j )
    for( int k = 0 ; k < 10 ; ++k )
    for( int m = 0 ; m < 10 ; ++m )
      {
          int number = i*1000 + j*100 + k*10 + m ;
          int digits = i*10 + j + k*10 + m ;
          if( digits * digits == num )
		  cout<<i<<j<<k<<m<<endl;
      }
	int temp;
	for(int j=1000; j<9999; ++j)
	{
		temp = num +  num;
	
	if ((temp * temp) == j)
	
		cout<<"Section 1 numbers "<<j<<endl;
	}

	for( int i = 0 ; i < 10 ; ++i )
	for( int j = 0 ; j < 10 ; ++j )
    for( int k = 0 ; k < 10 ; ++k )
    for( int m = 0 ; m < 10 ; ++m )
      {
          int number = i*1000 + j*100 + k*10 + m ;
          if( number < 10 ) continue ;
          int sum_cubes = i*i*i + j*j*j + k*k*k + m*m*m ;
          if( sum_cubes == number );
		  cout<<number<<sum_cubes<<endl;
      }
		
	return 0;
}

Based on the inputs from the prevoius posts..this is what i came up with, but is wrong, any help is appreciated....i'll be reposting to see if I can get this...thx in advance.

zandiago 115 Nearly a Posting Maven Featured Poster
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;

int main ()
{
	int num; 
	for(int j=0; j<9999; j++)
	{	
		partA = num%10 <<endl;
        num /= 10;
  
		num = partA(j) +  partB(j);
	
	if ((num * num) == j)
	
		cout<<"The number is: "<<j<<endl;
	}

	return 0;
}

So pretty much, I'm trying to do the program without the functions that n.aggel had pointed out...the program compiles ok and shows the correct answer, but our professor doesn't want us to use functions as yet (apart from the main function). But n.aggel, if you start at 0, instead of the smallest 4 digit # (and then do the loop), 0's many be included in the output?

zandiago 115 Nearly a Posting Maven Featured Poster

So what kind of problems are you having with your computer?

zandiago 115 Nearly a Posting Maven Featured Poster

Thx much n.aggel. It does work, what im going to do, is make a bit of modifications to it and repost. The thing is, even though i know a little bit about the use of different functions, the class hasn't reached that section yet, and some of these professors don't want anything that they haven't covered yet...i appreciate your help.

zandiago 115 Nearly a Posting Maven Featured Poster

SAID- Saint Albert Is Drowning

we'll just continue

zandiago 115 Nearly a Posting Maven Featured Poster

Idiot people aren't stupid after all.

zandiago 115 Nearly a Posting Maven Featured Poster

Yes.

Has someone told you that you talk while sleeping?

zandiago 115 Nearly a Posting Maven Featured Poster

Do you have the soun/clip in a WAV file?

zandiago 115 Nearly a Posting Maven Featured Poster

narsharma14....a few things:
1. Introduce yourself in the Geek lounge.
2. If you have a specific problem-post the code(not on my thread) and the guys here will take a look at it and help you.
3. Daniweb provides tutorials on several topics. You can go to goofle and search for a specific topic or the tutorials here (which are good).
4. Don't post your personal code/question on someone elses thread unless it's related to the orignal question...you need to start your own thread.
5. Don't post questions and expect an answer right away or any assistance if you don't try. We're all here to help you learn (even though I don't know a lot either)..
6. I reccommend taking a look at the Rules & FAQ for the daniweb forum.

Thanks.

zandiago 115 Nearly a Posting Maven Featured Poster

The assignment is :

Write a C++ program that calculates the volume of 3 different geometric shapes. Your
program should give the user a menu like the following and repeat until the user wants to stop.
Volume Calculation Program
Select the Number of Your Chosen Object
1. Dumbbell
2. Axle
3. Spear
When the user selects one of the 3 objects, the program should then request the appropriate measurements (in inches) and then calculate and display the volume of that object. The result should be printed showing cubic-inch units with 3 decimals of precision.
Axle: 2 cylinders and a rod
Dumbbell: two spheres and a rod
Spears: two cones and a rod

Program requirements and Assumptions
Formulas and Abbr.
II P1 = 3.141 59
r radius
= height (or length)
Vol. of a sphere = 4I3flr3
Area of a circle = flr2
Vol. of a cylinder fl9b
Vol. of a cone = 1/3fJr2h
1. The rod-end fits against the dumbbell ball snugly; there is no “air-gap’. You may assume that there is no loss of volume of the ball when the rod is fitted against it.
2. The radius of the dumbbell and axle center rods cannot be larger than half the radius of the ball or wheel. Do not make calculations if the rod radius is more than half of the ball or wheel radius. Give the …

zandiago 115 Nearly a Posting Maven Featured Poster

Thanks a lot, worked just fine..apprecaite it, u may wanna take a look at my other posts...

zandiago 115 Nearly a Posting Maven Featured Poster
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;


int main()
{
	    

	double standardDev(int, int, int);
	
	srand ( static_cast<unsigned int> ( time ( 0 ) ) );
    int i,j;
    int Low = 147;    
    int High = 206;
    int numbers = 0;//the actual numbers
    
    double avg = 0.0;//average of group of numbers

    
    

    int count = 0;
    int sum = 0;
    int sumsquared = 0; 


	for (i=147; i < 207; i++)
    {
        count += 1;
        numbers = rand() % (High - Low + 1)+ Low;
		if (i%5==0)
		
			cout << numbers << endl;
		

        sum += numbers;
        sumsquared += (numbers * numbers);
    }
	
	for (i=0;i<count-1;i++)
	{
	for (j=i+1;j>count; j++)

	if (count>numbers)
	swap (count,numbers);
	}

    if (count > 0) 
	{
        avg = ((double) sum / (double) count);
        cout << "\n\nCount is: " << count << endl;
        printf("Average is: %.2f\n", avg);
        printf("Deviation is: %.3f\n\n", standardDev(sum, sumsquared, count));
    }

    return 0;
}

	// Function for calculating standard deviation
	double standardDev(int sum, int sumsquared, int count) {
    double deviation = (double) (sumsquared - ((sum * sum) / count));
    deviation = deviation / (double) (count - 1);
    double stndDev = sqrt(deviation);
    return stndDev;


		
		return 0;
}

I made a bit of adjustments...regardless of what I put...it still shows a count of 60..though it only prints 10 numbers. Actually the count of numbers was suppose to be between 93 and 139 #'s whose range is between 147 and 206.
Thx for any assistance.

zandiago 115 Nearly a Posting Maven Featured Poster
zandiago 115 Nearly a Posting Maven Featured Poster

I've always thought about this too....but if you need different colour text..i think you could use "
#define yl system("color 0e");".

zandiago 115 Nearly a Posting Maven Featured Poster

Thanks much for all the feedback...I modified the program and it calcualtes the number correctly.:P

zandiago 115 Nearly a Posting Maven Featured Poster

Just out of curiosity...I'd like to know the amount of posts that are required to progress through the different levels of poster...ie. New poster---->junior poster in training------>Junior poster------>?

zandiago 115 Nearly a Posting Maven Featured Poster

I need a head-up on this program....i really don't know where to start....however for section one, i'm guessing we'll have to use for loop from 1000 to 9999...because of the fact that they show the range of the samllest to largest 4 digit #'s. In section two I guess we'd have to set some value from the lowest 2 digit # to the largest 4 digit #. I'll try to start a code and post as soon as I can. The assignment is as follows:
There are two sections to this program.
Section one:
Write a C++ program that determines which four digit numbers meet the following conditions:
Add the first two digits as a number to the last two digits as a number. The square of this sum equals the original number.
Example:
Original number is 4321. Determine if 43 + 21 which equals 63, when squared, is 3969 is equal to the original number (4321).
Section two:
The program continues by determining which 2, 3, and 4 digit numbers are equal to the sum of the cubes of their digits.
Example:
If the original number is 234, determine if 2 cubed (8) + 3 cubed (27) + 4 cubed (64) which is 99 is equal to the original 234.
Thanks for all the help.

zandiago 115 Nearly a Posting Maven Featured Poster

Oh goodness...now it prints only 12 numbers...but still says that the 'count' is 60. My revised code:

#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;


int main()
{
	    

	double standardDev(int, int, int);
	
	srand ( static_cast<unsigned int> ( time ( 0 ) ) );
    int i,j;
    int Low = 147;    
    int High = 206;
    int numbers = 0;//the actual numbers
    
    double avg = 0.0;//average of group of numbers

    
    

    int count = 0;
    int sum = 0;
    int sumsquared = 0; 


	for (i=147; i < 207; i++)
    {
        count += 1;
        numbers = rand() % (High - Low + 1)+ Low;
		if (i%5==0)
		
			cout << numbers << endl;
		

        sum += numbers;
        sumsquared += (numbers * numbers);
    }
	
	for (i=0;i>count-1;i++)
	for (j=i+1;j>count; j++)
	if (count>numbers)
	swap (count,numbers);
	

    if (count > 0) 
	{
        avg = ((double) sum / (double) count);
        cout << "\n\nCount is: " << count << endl;
        printf("Average is: %.2f\n", avg);
        printf("Deviation is: %.3f\n\n", standardDev(sum, sumsquared, count));
    }

    return 0;
}

	// Function for calculating standard deviation
	double standardDev(int sum, int sumsquared, int count) {
    double deviation = (double) (sumsquared - ((sum * sum) / count));
    deviation = deviation / (double) (count - 1);
    double stndDev = sqrt(deviation);
    return stndDev;


		
		return 0;
}
zandiago 115 Nearly a Posting Maven Featured Poster

As a matter of fact...at FSU, in florida there is a cricket team....What happened to Mulitheran? Did they still have a problem with his bowling technique?

zandiago 115 Nearly a Posting Maven Featured Poster

I had run the following...however, it shows that the number of vowels is 0.

#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;


int main()
{
	ifstream inFile;
	inFile.open ("vowels.txt");

	string sentence;//sentence from inFile
	

	char ch;
	int i;
	int length = 0;
	int numz = sentence.length();//number of vowels
		
	while (getline(inFile,sentence))
	{
	cout<<sentence<<endl;
	

	for (int i = 0; i < numz; ++i)
	{
		switch (ch)
		case 'a': case 'e': case 'i': case 'o': case 'u':
		
		{
			numz++;
		}
	}
	}
	

	cout<<"The number of vowels: "<<numz<<endl;

	inFile.close();
	return 0;
}
zandiago 115 Nearly a Posting Maven Featured Poster

Below is my revised version of the code...No alternation was made, dunno why it's not compiling:

#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;


int main()
{
	ifstream inFile;
	inFile.open ("vowels.txt");

	string sentence;//sentence from inFile
	

	char ch;
	int i;
	int length = 0;
	
	
	while (getline(inFile,sentence))
	{
	cout<<sentence<<endl;
	

	int numz = sentence.length();//number of vowels

	for (int i = 0; i < numz; ++i)
	{
		switch (ch)
		case 'a': case 'e': case 'i': case 'o': case 'u':

		{
			numz++;
		}
	}
	}
	

	cout<<"The number of vowels: "<<numz<<endl;

	inFile.close();
	return 0;
}

Thx for the assistance..

zandiago 115 Nearly a Posting Maven Featured Poster

Thx for the reply.....it's only one sentence...I had moved the '}'....the error message that i get is : "error C2065: 'numz' : undeclared identifier". Additionally, i get awarning which says: " warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data".

zandiago 115 Nearly a Posting Maven Featured Poster

Good day: There have been similar posts to my question...but i don't see what I'm doing wrong. Our professor wanted us to use a switch/case statement, we started transversing a string....The assisgnment : Write a program that will read in a one line phrase from a text file named “vowels.txt”.
Output, to the screen and printer, the phrase and then the number of vowels in the phrase.
Example:

The slippery eel found no help from an outside source .
The number of vowels is 18.

Below is what I've got so far:

#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;


int main()
{
	ifstream inFile;
	inFile.open ("vowels.txt");

	string sentence;//sentence from inFile
	

	char ch;
	int i;
	int length = 0;
	
	while (getline(inFile,sentence))
	{
	cout<<sentence<<endl;
	}

	int numz = sentence.length();//number of vowels

	for (int i = 0; i < numz; ++i)
	{
		ch = toupper (sentence [i]);
		if (isalpha (ch) && (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'))
		{
			numz++;
		}
	}
	

	cout<<"The number of vowels: "<<numz<<endl;

	inFile.close();
	return 0;
}
zandiago 115 Nearly a Posting Maven Featured Poster

My new code is as below:

#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;


int main()
{
	    

	double standardDev(int, int, int);
	
	srand ( static_cast<unsigned int> ( time ( 0 ) ) );
    int i,j;
    int Low = 147;    
    int High = 206;
    int numbers = 0;//the actual numbers
    
    double avg = 0.0;//average of group of numbers

    
    

    int count = 0;
    int sum = 0;
    int sumsquared = 0; 


    for (i=147; i > 146 && i < 207; i++)
    {
        count += 1;
        numbers = rand() % (High - Low + 1)+ Low;
        cout << numbers << endl;

        sum += numbers;
        sumsquared += (numbers * numbers);
    }
	for (i=147; i < 207; i++)
	{
		if (i%5==0)
		cout<<endl;
		
	}
	{
	for (i=0;i>count-1;i++)
	for (j=i+1;j>count; j++)
	if (count>numbers)
	swap (count,numbers);
	}

    if (count > 0) 
	{
        avg = ((double) sum / (double) count);
        cout << "\n\nCount is: " << count << endl;
        printf("Average is: %.2f\n", avg);
        printf("Deviation is: %.3f\n\n", standardDev(sum, sumsquared, count));
    }

    return 0;
}

	// Function for calculating standard deviation
	double standardDev(int sum, int sumsquared, int count) {
    double deviation = (double) (sumsquared - ((sum * sum) / count));
    deviation = deviation / (double) (count - 1);
    double stndDev = sqrt(deviation);
    return stndDev;


		
		return 0;
}

1. It's not generating more than 60 numbers
2. It's not being printed in 5 columns.
3. Is my bubble sort algorithm ok (it's suppose to print the numbers from high to low)?

Thx

zandiago 115 Nearly a Posting Maven Featured Poster

Aslo.....is my location of the colums algorithim correct? I also need to print the numbers in order from high to low.

zandiago 115 Nearly a Posting Maven Featured Poster

Ok I 've made the necessary adjustments to the program....but it's only generating 60 numbers.

zandiago 115 Nearly a Posting Maven Featured Poster

Below is what I have:

#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;


int main()
{
	    

	double standardDev(int, int, int);
	
	srand ( static_cast<unsigned int> ( time ( 0 ) ) );
    int i;
    int Low = 147;    
    int High = 206;
    int numbers = 0;//the actual numbers
    
    double avg = 0.0;//average of group of numbers

    
    

    int count = 0;
    int sum = 0;
    int sumsquared = 0; 


    for (i=147; i > 146 && i < 207; i++)
    {
        count += 1;
        numbers = rand() % (High - Low + 1)+ Low;
        cout << numbers << endl;

        sum += numbers;
        sumsquared += (numbers * numbers);
    }
	for (i=0; i>146 && i<206; i++)
	{
		if (i%5==0)
		cout<<endl;
		cout<<setw(10)<<numbers;
	}

    if (count > 0) 
	{
        avg = ((double) sum / (double) count);
        cout << "\n\nCount is: " << count << endl;
        printf("Average is: %.2f\n", avg);
        printf("Deviation is: %.3f\n\n", standardDev(sum, sumsquared, count));
    }
    else 
	{ 
		cout << "No calculation!" << endl;
	}

    return 0;
}

	// Function for calculating standard deviation
	double standardDev(int sum, int sumsquared, int count) {
    double deviation = (double) (sumsquared - ((sum * sum) / count));
    deviation = deviation / (double) (count - 1);
    double stndDev = sqrt(deviation);
    return stndDev;


		
		return 0;
}

A few things:
1. For some reason...it's not printing the numbers in the 5 columns that I want to.
2. I want it randomly print between 93 and 139 mnumbers...the values are ok..between 147 & …

zandiago 115 Nearly a Posting Maven Featured Poster

Thanks Acient Dragon.....thx for the info...i never knew that we could re-use integers..our professor never made any mention of that...This solves the problem.

zandiago 115 Nearly a Posting Maven Featured Poster

how could i leave out the red stripe

zandiago 115 Nearly a Posting Maven Featured Poster
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;



int main()
{

	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("listnames.txt");
	outFile.open ("outnames");

	string names[120];
	string name;
	int i, j, k;
	int count=0;
	while(count < 120 && getline(inFile,name))
	{
    names[count] = name;
    ++count;
	}
	{
	for (i=0;i<count-1;i++)
	for (j=i+1;j<count; j++)
	if (names[i]>names[j])
	swap (names[i],names[j]);
	}
	for (k=0; k<120; k++)
	{
		if (i%5==0)
		cout<<endl;
		cout<<setw(10)<<names[i];
	}
				
	inFile.close();
	outFile.close(); 

	return 0;
}

Thats what I have so far....however, i only the the colums for one of the lines of my inFile...in particular 'ZOVUROPA'....i copied the inFile into Microsoft Word and it located that particular line of letters @ line 120....i don't see what i'm doing wrong.....also, it doesn't print out in 5 columns as i wanted...it prints out in 7 instead....thx for the assistance.

zandiago 115 Nearly a Posting Maven Featured Poster

Bob Marley- Jammin

zandiago 115 Nearly a Posting Maven Featured Poster

well.....just had some jamaican jerk chicken (well hot and spicy)...yehmon

zandiago 115 Nearly a Posting Maven Featured Poster

Thanks for you reply...we haven't reached checking for integer length, but i'll read up on it and see how it works.

zandiago 115 Nearly a Posting Maven Featured Poster

Thanks to everyone for their assistance thus far. I have a bit of problem. When I try to compile the program...I get: Debug assertion failed (string subscript out of range)
So pretty much, the program was able to read the files from the infile..however since i inputted the loops I had those error messages. Below is my code:

#include <cstring>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <string>
#include <ctime>

using namespace std;



int main()
{

	
	ifstream inFile;
	ofstream outFile;

	inFile.open ("listnames.txt");
	outFile.open ("outnames");

	string names[120];
	string name;
	int i, j, k;
	int count=120;
	while(getline(inFile,name))
	{
	for (i=0;i<count-1;i++)
	for (j=i+1;j<count; j++)
	if (name[i]>name[j])
	swap (name[i],name[j]);
	}
	for (k=0; k<120; k++)
	{
		if (i%5==0)
			cout<<endl;
		cout<<setw(2)<<name[i];
	}//end for i
	
	
		
	inFile.close();
	outFile.close(); 

	return 0;
}

What I'm simply trying to do is sort the names in normal alphabetical order and then display them to the screen and print printer in 5 columns.(refer to my initial post for a copy of the inFile)...Thx much

zandiago 115 Nearly a Posting Maven Featured Poster

The only way to learn and master c++ is if you practice and get corrected....