[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Could anyone help me with my c++ programming homework? text

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 6
Thread images: 1

File: 1461374216802.jpg (69KB, 1278x720px) Image search: [Google]
1461374216802.jpg
69KB, 1278x720px
Could anyone help me with my c++ programming homework?

text is read from a file, user enters it's name.
need to print out all uppercase letters if there are more of them than lowercase ones, print each letter only once
otherwise print out all numbers in the text.

If the shortest and the longest lines character number sum in larger than a number that the user entered - print out how many lines there is in the text and average length of them.

If in a line the 2nd word's 3rd letter is an uppercase - calculate how many words are there in that line that start in lowercase, otherwise switch the shortest word with the longest one.

If in a line there are more words than the user's entered number - remove the 1st uppercase word from that line, otherwise the user enters where he wants to insert a word (enters the word himself and the position).

I don't necessarily need the entire program but just to get me started.
>>
>>217361
no one cared who he was until he collected all 12 kanohi
>>
>>217361
your post was confusing as fuck, is that your idea or the actual homework?

it doesn't sound too complex, just count the ascii codes to find uppercases and spaces, and then find out which option you want with an if, or a switch depending on which is true. Use booleans for that.

i don't even C++ but im pretty sure it uses conditionals and booleans, right?
now go do your own fucking homework
>>
>>217512
It looks like an examination-style homework, rather than a learn-by-doing-style homework.

That's why the program does a bunch of things that are complicated and non-useful.

The examiner will have a test harness, that can run the code through a bunch of edge-cases, and mark it automatically.

OP should be applying what he learned earlier in the course, had he been paying attention.

If OP makes an honest stab at it, he'll get at least one answer to any specific question he asks, coming from someone who could write that in his sleep.

If OP wants his homework done for him, he'd better hope someone more charitable comes along.
>>
>>217516
i just want a basis to start with, like how do i check each line individually for a start
i know most of that, what is needed to do but i want either a good source to learn this or some sort of a starter, since what my teacher gave me is less than bare bones
>>
>>217512
>i don't even C++ but im pretty sure it uses conditionals and booleans, right?
C doesn't have booleans.

In C, if something equals zero, it's false, and if it doesn't, it's true.

So if your char is guaranteed to only contain ASCII letters, then !(mychar&&0x20) is true if your char is upper-case.
Thread posts: 6
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.