Jump to content

Recommended Posts

/** Lab-5: lab5-3.cpp : Prime numbers
*Author: -(Replace this with your name here)
* Date: (replace this with today’s date)
 *********************************************************/
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int a, b, c;
int main ()
{
const int NUMBER_OF_PRIMES = 25;
const int NUMBER_OF_PRIMES_PER_LINE = 5;
int count = 0; // for counting the prime numbers
int number = 2; // starting number for prime number checking
cout << "The first 25 prime numbers are: " << endl; 
int x = 1;


cout << endl; 

for (a = 1; a <= 97; a++)
{
	for (b = 2; b < a; b++)
	{	
		if ((a%b) == 0)
			c = 0;
	}
if (c != 0) 
{	
	cout << setw(5) << a;
	if(x == 5)
	{		
		cout << endl;
		x=0;
	}
x=x+1;
}
c=1;
}




return 0;
}

some of the shit in there is pointless and doesnt need to be in there. im just too lazy to take it out.

Edited by Slinky

DD M4


Rockford Fosgate P500-4


SoundQubed HDC415 w carbon fiber cap


2 Rockford Fosagate T1675-S


XS Power D3400 Under Hood


XS Power D5100 in rear


Michael Singer 200A Alt


Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/

Link to comment
Share on other sites

  • 3 weeks later...
i remember my days of C++ ... so much fun

man i hate it. but im sticking with computer science so ill just have to wait it out.

DD M4


Rockford Fosgate P500-4


SoundQubed HDC415 w carbon fiber cap


2 Rockford Fosagate T1675-S


XS Power D3400 Under Hood


XS Power D5100 in rear


Michael Singer 200A Alt


Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/

Link to comment
Share on other sites

man i hate it. but im sticking with computer science so ill just have to wait it out.

C++ is nothing wait until you get into databases, assembly, and more object oriented programming... not to mention math :)

Glad I'm done next spring.

-Installer for Duke's Car Stereo

2000 Pontiac Grand Prix - Ported Eaton M90 S/C, 3.5" pulley, XS Power Headers, 1.9 Rockers, FWI, Poly Motor Mounts, Custom Tune.

RF T1000-1bdCP and T400-4

Boston Acoustics SPG 555

Kenwood eXcelon 995

RF Punch 6.5" components and MB Quart Premium 6x9"s

Powermaster Alternator, YellowTop D34, Vmax CT1000

Link to comment
Share on other sites

C++ is nothing wait until you get into databases, assembly, and more object oriented programming... not to mention math :)

Glad I'm done next spring.

well it sounds like i have a lot to look forward to then. :P

DD M4


Rockford Fosgate P500-4


SoundQubed HDC415 w carbon fiber cap


2 Rockford Fosagate T1675-S


XS Power D3400 Under Hood


XS Power D5100 in rear


Michael Singer 200A Alt


Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/

Link to comment
Share on other sites

well it sounds like i have a lot to look forward to then. :P

Truthfully once you learn C++ you'll be fine with most other languages. I picked up VB, Java, php, and javascript very easy after learning C++. Alot of schools are starting off with Java now instead of C++, idk I learned C++ first then java... and if I had to do it again I don't think I'd change anything.

My only words of advice... always plan beore you start programming rather it be an ns chart, flow chart, or whatever. It's a lot easier to follow your ideas/functions than trying to do it all in your head. And believe me they start to get complicated :)

-Installer for Duke's Car Stereo

2000 Pontiac Grand Prix - Ported Eaton M90 S/C, 3.5" pulley, XS Power Headers, 1.9 Rockers, FWI, Poly Motor Mounts, Custom Tune.

RF T1000-1bdCP and T400-4

Boston Acoustics SPG 555

Kenwood eXcelon 995

RF Punch 6.5" components and MB Quart Premium 6x9"s

Powermaster Alternator, YellowTop D34, Vmax CT1000

Link to comment
Share on other sites

Truthfully once you learn C++ you'll be fine with most other languages. I picked up VB, Java, php, and javascript very easy after learning C++. Alot of schools are starting off with Java now instead of C++, idk I learned C++ first then java... and if I had to do it again I don't think I'd change anything.

My only words of advice... always plan beore you start programming rather it be an ns chart, flow chart, or whatever. It's a lot easier to follow your ideas/functions than trying to do it all in your head. And believe me they start to get complicated :)

yeah my school does C++ first too.

my teacher tells us we should write the program ideas down on paper first and then try and type it out. i usually just do it in my head but when it gets more complicating im gonna have to do something like you said.

DD M4


Rockford Fosgate P500-4


SoundQubed HDC415 w carbon fiber cap


2 Rockford Fosagate T1675-S


XS Power D3400 Under Hood


XS Power D5100 in rear


Michael Singer 200A Alt


Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/

Link to comment
Share on other sites

yeah my school does C++ first too.

my teacher tells us we should write the program ideas down on paper first and then try and type it out. i usually just do it in my head but when it gets more complicating im gonna have to do something like you said.

werd like most of our programming assignments in 116 and 216(intro and advanced programming) were programs that processed a data file of like student grades... sometimes upwards of a couple hundred records... when you have to have functions that determine the high score, lowest score, average, letter grade, rank, pass/fail, etc... that's when me head started to hurt and I started writing things down.

-Installer for Duke's Car Stereo

2000 Pontiac Grand Prix - Ported Eaton M90 S/C, 3.5" pulley, XS Power Headers, 1.9 Rockers, FWI, Poly Motor Mounts, Custom Tune.

RF T1000-1bdCP and T400-4

Boston Acoustics SPG 555

Kenwood eXcelon 995

RF Punch 6.5" components and MB Quart Premium 6x9"s

Powermaster Alternator, YellowTop D34, Vmax CT1000

Link to comment
Share on other sites

werd like most of our programming assignments in 116 and 216(intro and advanced programming) were programs that processed a data file of like student grades... sometimes upwards of a couple hundred records... when you have to have functions that determine the high score, lowest score, average, letter grade, rank, pass/fail, etc... that's when me head started to hurt and I started writing things down.

yeah that does sound like its got a lot of stuff involved.

in my class last week we went over arrays and now we're going of streams

DD M4


Rockford Fosgate P500-4


SoundQubed HDC415 w carbon fiber cap


2 Rockford Fosagate T1675-S


XS Power D3400 Under Hood


XS Power D5100 in rear


Michael Singer 200A Alt


Build Log: http://www.stevemeadedesigns.com/board/topic/153901-2012-veloster-update-842013-wall-build-4-15s/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Who's Online   1 Member, 0 Anonymous, 1670 Guests (See full list)

×
×
  • Create New...