WARNING: This is an Archive -
Try the New TestMy.net
Welcome,
Guest
. Please
login
or
register
.
Home
Download Test
Test Your Download Speed
Test Both Download AND Upload
Upload Test
Test Your Upload Speed
Test Both Upload AND Download
Community
Forum Home
Help
Search
Calendar
Guides
ISP Discussion
» Log-In
» Register
Database Stats
Host Stats
Member Stats
Share Score
Misc Tools
Conversion Calc.
Speed Chart
Conversion Table
Create a Test
Share Score
Automatic Test
Forum Archive
Score Database
trace/ping/whois/DNS
Tweak Guide
!! Search !!
News
News Home
Join
»
Home
»
C++ Help!!
Home
Help
Search
Login
Register
News
:
Don't look stupid, make sure you keep up-to-date with our rules,
please read rules, click here
May 22, 2012, 05:20:50 AM
old.testmy.net forums
|
Main Forum
|
HELP!
|
Programming and Website Help
| Topic:
C++ Help!!
0 Members and 1 Guest are viewing this topic.
« previous
next »
Topic Tools
Search this topic
Pages
1
Author
Topic: C++ Help!! (Read 2213 times)
RAINMAKA
TMN Friend
Offline
Gender:
Posts: 461
C++ Help!!
«
on:
March 22, 2006, 12:54:26 PM »
i have a test coming up in my C++ class and my professor gave me this problem to help me get ready. im and having trouble writing the program and not too sure where to start. any help would be great. the problem is the attached picture.
Logged
CPU Z
Swimmer
Vice Admin
TMN Seasoned Veteran
Offline
Gender:
Posts: 6373
Re: C++ Help!!
«
Reply #1 on:
March 22, 2006, 02:10:24 PM »
let me look at it later.. i know C# and php knows a bit of C++..
Logged
disturbed
News Anchor
TMN Veteran
Offline
Posts: 2067
I am and always will be disturbed.
Re: C++ Help!!
«
Reply #2 on:
March 22, 2006, 03:40:34 PM »
i speak cpp - i can point you in the right direction, but i wont write the code for you
*writing stuff as we speak - give me few minutes
Logged
Are you down with the sickness !?
[
http://hackaday.com
]
disturbed
News Anchor
TMN Veteran
Offline
Posts: 2067
I am and always will be disturbed.
Re: C++ Help!!
«
Reply #3 on:
March 22, 2006, 03:59:50 PM »
...like i said, i wont write the code for you but ill point you in the right direction - i really have no idea where you stand when it comes to cpp so ill try and be as simple as possible
- You should understand what a struct is: struct is one of the structure types in cpp - it can be composed of several differnet types of elements - since you are working with a linked list of struct objects (named element), you should understand that they have to be connected by pointers (thus the element *next as the element of the struct)
- the element *next basically points to the next elemnt in the struct linked list
- you can start our your linked list by saying
element *Head = NULL;
this is said to be a dummy node
...now im gonna be nice - you can use the similar code to do the rest of your assignment, its quite simple actually
void addNode(element **head, int yourInteger) {
element *tmp;
if ((tmp = malloc(sizeof(*tmp))) == NULL) {
ERR_MSG(malloc);
(void)exit(EXIT_FAILURE);
}
tmp->data = yourInteger;
tmp->next = *head;
*head = tmp;
}
- there I noticed that you also need a random integer created - this has an easy solution - since im just trying to be simple, you should do this
create a variable count that keeps track of how many elements you have - every time you want to create a new element, you can pass that variable to a helper method that can take that count variable and lets say add 5 to it and multiply it by 2 (example...you currently have 2 elements in your linked list - you wanna create a 3rd one - pass 2 to the method, method adds 5 to it = 7 and multiply it by 2 - that will equal 14 - there is your randomly generated number)
you can also use the 'time' function of c, which takes the current number of computer clocks to generate a random number - but no need to make it more complicated
to put elements in the right order, you can use any sorting method: bubble sort, merge sort (would be best since you are already working with linked lists), quick sort - you can find algorithms on the web
......i think i coverd the basis - if you have any more questions ask away
Logged
Are you down with the sickness !?
[
http://hackaday.com
]
RAINMAKA
TMN Friend
Offline
Gender:
Posts: 461
Re: C++ Help!!
«
Reply #4 on:
March 22, 2006, 06:02:42 PM »
disturbed thanks for your help, i have it almost done. i just have to do the part where i create a element inbetween and i just cant get it to work. if you want me to post the coding i have so far just let me know.
Logged
CPU Z
disturbed
News Anchor
TMN Veteran
Offline
Posts: 2067
I am and always will be disturbed.
Re: C++ Help!!
«
Reply #5 on:
March 22, 2006, 06:49:10 PM »
to create an element in between - you can simply make another pointer that points to some element in your linked list and in the method i wrote there for you, instead using the head, use the pointer to that new pointer
get what i mean ?
Logged
Are you down with the sickness !?
[
http://hackaday.com
]
Swimmer
Vice Admin
TMN Seasoned Veteran
Offline
Gender:
Posts: 6373
Re: C++ Help!!
«
Reply #6 on:
March 22, 2006, 07:29:27 PM »
A+ for disturbed!
Logged
disturbed
News Anchor
TMN Veteran
Offline
Posts: 2067
I am and always will be disturbed.
Re: C++ Help!!
«
Reply #7 on:
March 22, 2006, 10:02:37 PM »
glad to be of help
Logged
Are you down with the sickness !?
[
http://hackaday.com
]
Pages
1
old.testmy.net forums
|
Main Forum
|
HELP!
|
Programming and Website Help
| Topic:
C++ Help!!
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Main Forum
-----------------------------
=> General Discussion
=> PC Security
===> Antivirus & Firewalls
===> Spyware & Malware
===> Viruses & Scams
===> Security Threats
=> Show off your scores!
=> Make it Faster...
=> HELP!
===> HELP! With Other Stuff
===> HELP! With Tests
===> HELP! With Forum
===> Programming and Website Help
=====> HTML
=====> PHP
=====> PERL
=====> Server Help
===> Networking and Hardware
===> Overclocking
===> Linux Help
=> News
===> testmy.net News and Updates
=> Online Gaming Discussion
===> Requests
===> America's Army
===> Battlefield
===> Counter-Strike 1.6
===> Counter-Strike : Source
===> Day of Defeat : Source
===> Diablo
===> F.E.A.R
===> Ghost Recon
===> Halo 2
===> Lineage 2
===> Quake
===> Rainbow Six 3
===> World of Warcraft
===> Tribes 2
===> Unreal Tournament
=> Graphics, Sigs and Pictures
===> Test Board
=> Guides
=> Got any ideas to make testmy.net better?
=> Off Topic Discussion
-----------------------------
Provider Discussion and Reviews
-----------------------------
=> Add a Provider
=> All Dial-up
=> North American Providers (Including Canada)
===> Canadian Providers
=====> teksavvy.com Canada
=====> xplornet.com Canada
=====> Persona Internet
=====> Rogers Communications
=====> Shaw Communications
=====> Sympatico (Bell Canada)
===> Adelphia Communications
===> ALLTEL Communications
===> AOL
===> AT&T WorldNet
=====> SBC (merged with AT&T) [old posts]
===> BellSouth
===> Cable One
===> Cavalier Telephone cavtel.net
===> cebridge.net
===> CenturyTel
===> Charter Communications
===> Comcast Cable Communications
===> Country Cablevision
===> Covad communications
===> Cox Communications
===> DMAX Puerto Rico
===> HughesNet (DIRECWAY)
=====> DW4000 Information
=====> DW6000 Information
=====> DW7000 Information
===> EarthLink
===> Insight Broadband
===> Mediacom Communications
===> mycingular.net
===> Namesco/NDO (ndo.com)
===> onelinkpr.net Puerto Rico
===> Optimum Online
===> Qwest Communications
===> RCN
===> RoadRunner (Time Warner Cable)
===> seidata.com
===> sigecom.net
===> Speakeasy
===> Sprint Nextel Corporation
===> Starband
===> SureWest Communications
=====> SureWest Communications FIOS
===> SusCom - Susquehanna Communications
===> TDS - Telephone and Data Systems, Inc
===> Transedge.com
===> Verizon Online
===> Verizon Online FIOS
===> Wave Broadband
===> Wide Open West
===> Wildblue Communications, Inc
=> World Providers (Non-North American)
===> African Providers
===> Asian and Middle Eastern Providers
=====> Asian Providers
=====> Sify Broadband
=====> Streamyx
=====> Smart Bro (Wi-fi)
===> Australian Providers
=====> Digiplus
=====> Optusnet
=====> Telstra Bigpond
===> UK and European Providers
=====> Bredbandsbolaget
=======> Bredbandsbolaget Fiber
=======> Bredbandsbolaget ADSL, VDSL
=====> Virgin.net (old NTL)
=====> Tiscali
===> Central/South American Providers
-----------------------------
Miscellaneous
-----------------------------
=> Archives
===> Announcements
=> Public Polls
===> Not on index
Print
Advanced search
Page created in 0.112 seconds with 20 queries.
Powered by SMF 1.1.13
|
SMF © 2006-2011, Simple Machines LLC
Loading...
© 2007 testmy.net -
Contact
-
Legal
- This is an older version:
Try Bandwidth Speed Test v12