Project 1999

Go Back   Project 1999 > General Community > Off Topic

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 01-31-2014, 06:30 PM
phacemeltar phacemeltar is offline
Planar Protector

phacemeltar's Avatar

Join Date: Jun 2013
Location: western hemisphere
Posts: 1,612
Default learning C

hi all, i am having some trouble learning c. its for this class i am taking outside of school, and i want to do well. what i am having trouble with is figuring out how the syntax works.
is there anyone willing to help me learn some rudimentary principles? here is a link to the problem set. i am having trouble with the mario problem.

can someone please explain how to put the blank spaces in, and also how to make new lines?
__________________
  #2  
Old 01-31-2014, 06:36 PM
quido quido is offline
Planar Protector

quido's Avatar

Join Date: Oct 2009
Posts: 5,519
Default

Read about whitespace and escape sequences in C =P
__________________
Jack <Yael Graduates> - Server First Erudite
Bush <Toxic>
Jeremy <TMO> - Patron Saint of Blue
  #3  
Old 01-31-2014, 07:41 PM
baalzy baalzy is offline
Planar Protector

baalzy's Avatar

Join Date: Mar 2011
Posts: 1,860
Default

http://www.learn-c.org/
__________________

Baalzy - 57 Gnocro, Baalz - 36 Ikscro, Adra - 51 Hileric, Fatbag Ofcrap - 25 halfuid

Red99
Baalz Less - Humger, Baalzy - Ikscro

If MMORPG players were around when God said, "Let there be light" they'd have called the light gay, and plunged the universe back into darkness by squatting their nutsacks over it.
Picture courtesy of azeth
  #4  
Old 01-31-2014, 07:45 PM
dre dre is offline
Banned


Join Date: Jan 2014
Posts: 91
Default

Learn C#, download eqbrowser source, pras.

Learn C++, download Eqemu source, pras
  #5  
Old 01-31-2014, 07:45 PM
stormlord stormlord is offline
Planar Protector


Join Date: Nov 2009
Posts: 1,165
Default

If I recall, it's something like cout << " ##";

The ASCI for a space is 32 (decimal) I think.

Or is that c++?

I started with c or c++ in school, I forget. I used Turbo C++.

As far as the code is concerned, it looks simple to me. Each row above the bottom has (0+row) spaces. It looks like hte platform at the top is 2 characters in length. The width of the total pyramid can be estimated by (height+1). The number of blocks per row can be estimated by (width of the pyramid-spaces).

EDIT: I forgot about the role of printf in C.

You will probably want to loop printf(" "); to insert spaces on the line.
Insert pound signs the same way by looping printf("#"); and ending with printf("\n");

Honestly you just need to experiment with it.
__________________
Full-Time noob. Wipes your windows, joins your groups.

Raiding: http://www.project1999.com/forums/sh...&postcount=109
P1999 Class Popularity Chart: http://www.project1999.com/forums/sh...7&postcount=48
P1999 PvP Statistics: http://www.project1999.com/forums/sh...9&postcount=59

"Global chat is to conversation what pok books are to travel, but without sufficient population it doesn't matter."
Last edited by stormlord; 01-31-2014 at 08:16 PM..
  #6  
Old 01-31-2014, 07:52 PM
quido quido is offline
Planar Protector

quido's Avatar

Join Date: Oct 2009
Posts: 5,519
Default

Borland Turbo C++ lol - I used to use that.

He's probably expected to use printf/scanf, not cout/cin and the stream operators as they are from C++.
__________________
Jack <Yael Graduates> - Server First Erudite
Bush <Toxic>
Jeremy <TMO> - Patron Saint of Blue
  #7  
Old 01-31-2014, 08:19 PM
stormlord stormlord is offline
Planar Protector


Join Date: Nov 2009
Posts: 1,165
Default

Quote:
Originally Posted by quido [You must be logged in to view images. Log in or Register.]
Borland Turbo C++ lol - I used to use that.

He's probably expected to use printf/scanf, not cout/cin and the stream operators as they are from C++.
Ya when I made the initial post I forgot about.

What do you do with programming? I use it as a hobby. I took classes in colllege. My first exposure to it was when I was a sophmore in HS. I was using Qbasic. It's an easy language to start out.

Alwys interested to hear from other programmer.
__________________
Full-Time noob. Wipes your windows, joins your groups.

Raiding: http://www.project1999.com/forums/sh...&postcount=109
P1999 Class Popularity Chart: http://www.project1999.com/forums/sh...7&postcount=48
P1999 PvP Statistics: http://www.project1999.com/forums/sh...9&postcount=59

"Global chat is to conversation what pok books are to travel, but without sufficient population it doesn't matter."
Last edited by stormlord; 01-31-2014 at 08:48 PM..
  #8  
Old 01-31-2014, 08:20 PM
phacemeltar phacemeltar is offline
Planar Protector

phacemeltar's Avatar

Join Date: Jun 2013
Location: western hemisphere
Posts: 1,612
Default

Quote:
Originally Posted by baalzy [You must be logged in to view images. Log in or Register.]
genius! im working on this now.

thanks to everyone else for all the answers. this assignment isnt due for awhile, but im falling behind in my group due to my confusion.
mainly im having a hard time figuring out how to write one algorithm that will print multiple lines based on user-input.

ill read through these responses and hopefully i can come up with something.
__________________
Last edited by phacemeltar; 01-31-2014 at 08:20 PM.. Reason: forgive my ignorance of terminology
  #9  
Old 01-31-2014, 08:27 PM
quido quido is offline
Planar Protector

quido's Avatar

Join Date: Oct 2009
Posts: 5,519
Default

you should learn about variables, and then loops =) these are essential for solving this problem
__________________
Jack <Yael Graduates> - Server First Erudite
Bush <Toxic>
Jeremy <TMO> - Patron Saint of Blue
  #10  
Old 01-31-2014, 08:27 PM
baalzy baalzy is offline
Planar Protector

baalzy's Avatar

Join Date: Mar 2011
Posts: 1,860
Default

Its been forever since I've done anything with C and I always hated it, so I never got into making elegant solutions. For something suitable you can use these concepts to solve this and then I'll provide some really weakass pseudo-code for you:

Concepts:
http://www.learn-c.org/en/Arrays
http://www.learn-c.org/en/Strings
http://www.learn-c.org/en/For_loops
http://www.learn-c.org/en/While_loops
(If you don't know about Variables and If-Else statements you should read up on them also).

Weakass pseudo-code for the printing of valid input only, stored in a variable called N:
Create Char array.

print the text "Height: " with the value from N appended after the space.

Use a forloop. Your goal here is to Print a line at the end of each cycle until you have printed N lines.

Using a while loop here (inside the forloop), your goal is to fill in the appropriate number of Blank spaces in your array and then the appropriate number of hashes. Think about what you can do with an Array and a While loop to accomplish this goal.
Hint: If this is the first time the Forloop has ran, you'll want to print N-2 spaces followed by two hashes.

After the while loop is finished, before the end of the forloop. Print the array.

Edit: After thinking about this a bit more it's possible to do this without an array too, and might be easier for you.
__________________

Baalzy - 57 Gnocro, Baalz - 36 Ikscro, Adra - 51 Hileric, Fatbag Ofcrap - 25 halfuid

Red99
Baalz Less - Humger, Baalzy - Ikscro

If MMORPG players were around when God said, "Let there be light" they'd have called the light gay, and plunged the universe back into darkness by squatting their nutsacks over it.
Picture courtesy of azeth
Last edited by baalzy; 01-31-2014 at 08:44 PM..
Closed Thread


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:10 AM.


Everquest is a registered trademark of Daybreak Game Company LLC.
Project 1999 is not associated or affiliated in any way with Daybreak Game Company LLC.
Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.