- 0
[C++] Tutorial #1 Simple Sum/Average
Asked by
coolbunny1234,
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By zikalify · Posted
BBC threatens Perplexity with legal action over content scraping by Paul Hill Image via Depositphotos.com The UK’s public broadcaster, BBC, has written a letter to Perplexity, the AI search startup, asking it to stop scraping articles from its websites, delete existing copies of content, and propose some sort of financial compensation if it would like to carry on scraping data. If the demands are not met, BBC may seek an injunction against the startup citing alleged misuse of its intellectual property. BBC is probably responding in this way because it has seen other news organizations cement deals with firms like OpenAI and Mistral. The income stream allows news organizations to raise more funds and also cover the costs of the extra load on their servers caused by AI scraping. For anybody not familiar with Perplexity, it’s a bit like ChatGPT but has a much stronger emphasis on searching the web to find information. You can ask it anything you want to know about and it very quickly searches online and constructs a specific response to your question based on what it has found. The company offers many of its features for free, but does have Perplexity Pro, which costs money. Essentially, Perplexity is making money from publishers by using their content to improve its own product, but not paying them all. Perplexity's defense and existing publisher programs In a statement to the Financial Times, Perplexity labeled the BBC’s claims as "manipulative and opportunistic". The startup accused the broadcaster of having “a fundamental misunderstanding of technology, the internet and intellectual property law.” This is not the first time Perplexity has had a run-in with the media. Forbes and Wired accused it of plagiarizing content from their websites and The New York Times sent the company a cease and desist notice to stop using its content for AI purposes. To assuage publishers, Perplexity has set up a revenue sharing program, which includes TIME, Fortune, Der Spiegel, and others. According to Digiday, the revenue share was up to 25%. It’s not clear if BBC has tried engaging through this avenue or if it wants to try to squeeze the startup for a bigger slice. The escalating battle over AI and intellectual property Even if you only keep up with AI developments in passing, you’ll likely have seen that AI models need to be trained on vast amounts of data, much of which is copyrighted. There is an ongoing debate about whether these companies should be allowed to train on this data, or first seek out permission from the copyright holders. The move from the BBC could spur other publishers on to try and get themselves a better deal from Perplexity. Alternatively, Perplexity could remove BBC content from its platform and stop pulling information from there. It could probably find most of the information elsewhere, but if Perplexity tried to pull this too much it would eventually end up pretty useless with not a lot of content. Overall, this is just one of many ongoing legal issues surrounding AI, but once a conclusion has been reached, it could set a precedent about how AI companies should go about getting content from publishers. Source: FT via Reuters -
By dustojnikhummer · Posted
No, it's in fact not always there. You have to enable the FPS overlay first, either in Steam general settings or in the.... Steam Overlay... which is Shift+Tab. And what is that? A keyboard shortcut -
By dustojnikhummer · Posted
Mangohud hasn't been built into anything but the Steam Deck until now, you had to set it up yourself. -
By Jdoe25 · Posted
M$ Start Menu and its Oddities: What Do They Know? Do They Know Things?? Let's Find Out! Short answer is "you actually want Open-Shell or any of its paid alternatives". -
By Jdoe25 · Posted
Windoze 11 delivering whatever drivers to me in a recent laptop (2024) made me disable the ability to receive drivers altoghether. I was repeatedly losing the ability to have a lighted keyboard, because I'd install the most recent driver from the manufacturer, and Windoze would immediately "replace it" or "complement it" with a whatever "Component download" of its own. Wasted me a couple of days troubleshooting that crap. Windoze 11 wasting my time since like forever.
-
-
Recent Achievements
-
KynanSEIT earned a badge
One Month Later
-
gowtham07 earned a badge
One Month Later
-
lethalman went up a rank
Collaborator
-
Wayne Robinson earned a badge
Week One Done
-
Karan Khanna earned a badge
One Month Later
-
-
Popular Contributors
-
Tell a friend
Question
coolbunny1234
As I do on most forums that I join, I usually post a series of tutorials for programming, specifically C++. I'll be creating tutorials at random or by request, and usually cover most of the basics, advancing into intermediate programming and later scratching the surface of more advanced programs.
This tutorial assumes you have basic, minimal knowledge of C++.
What you will need:
And that's it! I currently use Visual Studio 2013 Professional, I got it for free via Dreamspark (if you're a college student like myself, go grab it now) or download the evaluation software.
http://www.visualstudio.com/downloads/download-visual-studio-vs
Now for the tutorial! This program is a simple program that asks the user to specify the amount of grades you want averaged and summed. It then asks for the actual grade of each, followed by the logic of average/sum of the user specified grades.
Step 1
Open Visual Studio, and click File > New Project. A pop up window will appear, and on the left hand tab, select Visual C++, and then Win32 Console Application.
A screen will appear, click next, but do not click finish on the next screen!
Before clicking Finish, make sure you check off the box that says "Empty Project"
Next, Click the tab Project > Add New Item
A screen will appear like this one, chose the .cpp and name it whatever you'd like. This file is the source code file for your program.
You now have a blank workspace for your program, time to dive into the language.
Step 2
We're now going to add the file headers to the source. There are many functions and inputs in the language of C++, and these headers allow us access to them so we don't have to code them individually in each program. I.e the function "cout" , or command output, allows us to print whatever we want on screen.
So go ahead and add these file headers.
And here's an image for the visual learners of what it should be so far.
Step 3
After we add the headers, we need to initiate a start up function, and the default function that's called when a program is ran is int main(). Your entire source for your program, or the entire logic of the program, is within these parameters.
(I'll be adding code to previous code so it's chronological and makes more sense).
Boom! This is our entire program. Within those brackets, you can do whatever, such as say hello..
And if you ran this, it would create a program that says Hello Neowin. Simple, helloworld crap.
Step 4
However, we want to create a program that does averages/sums of user specified input. So how do we do that?
First, we're going to need to init and double a few variables.
The variables above are as follows:
Step 5
We now need to have the program ask the user how many grades are going to be inputted.
Let's break this down a little if you're lost. Currently, the code above simply is going to print out on screen "How many grades are you going to enter?", and n_grades will record whatever number you input.
Step 6
Now for the hardest part of the program. How are we going to code something that gives the user infinite amount of options (how many grades he can input... 1- infinity)? This is where the for loop comes in handy. I'm going to post the code first, then explain.
As you can see, the for loop above does it all for us. If you can't see however, read on. The first line of the loop
Simply inits the variable count, which we use to determine how many times we ask the user to enter a grade, based on his input before. Then, if count is less than or equal to n_grades, then we increment count by one, or count++.
Within the loop, we also take care of the math part of figuring out the sum of the grades, using
which is the same as
Step 7
The rest of the program is a cruise from this point on. We just need to to the math logic for the average, and output the results!! I'll post the full source below, as I've got to finish this up quickly.
And voila! We have a simple program that allows us to find the average and the sum of a user specified number. Sorry for the shortness and briefness of the tutorial, gotta run out the door as we speak. Let me know any areas that could be improved, tutorial wise or code wise. Thank you!
Link to comment
https://www.neowin.net/forum/topic/1207513-c-tutorial-1-simple-sumaverage/Share on other sites
13 answers to this question
Recommended Posts