Професионална програма
Loading...
+ Нов въпрос
LoshaPanda avatar LoshaPanda 10 Точки

Product sign{2} - C++ fundamentals

Извинете ме, но не мога да си намеря грешка. Може ли някой да ме поправи ако вижда такава ?

 

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main() {

	double n, n1, n2, k = 0;

	cin >> n >> n1 >> n2;

	if (n < 0){
		k++;
	}
	if (n1 < 0){
		k++;
	}
	if (n2 < 0){
		k++;
	}

	if (k == 1)
	{
		cout << '-';
	} else if (k == 2) {
		cout << '+';
	} else if (k == 3) {
		cout << '-';
	} else if (k == 0){
		cout << '+';
	}

}

 

Тагове:
0
C++ Programming
MartinBG avatar MartinBG 3192 Точки
Best Answer

Какво е условието на задачата? Без него няма как да разгадаем какво не работи ;)

Иначе, не виждам причина да се използва тип double за променливите - int изглежда по-удачен тип за начина, по кийто се използват тези променливи в кода. 

0
MartinBG avatar MartinBG 3192 Точки

LoshaPanda  - Кодът ти не покрива сценариите, когато едно или две от числата са 0 (по условие резултатът трябва да е "+", независимо от останалите числа).

0
LoshaPanda avatar LoshaPanda 10 Точки

Благодаря за помощта !

1
ishwaryaishu avatar ishwaryaishu 1 Точки

Created in 1958, this genius introduced flooring goes down quick and has barely any, creases.

vinyl strip flooring 

Consolidates PVC for sturdiness; fiberglass for strength; froth gel for solace, surface, and protection; and urethane for toughness. As a result of its weight, it can basically be free laid over a subfloor, or stuck down for more lastingness.

0
raphile avatar raphile 0 Точки

From their tremendous limit and involvement with Malaysia and globally, SP Setia chose to wander into the ever dynamic Singapore property showcase in 2012 and awaited their lady plot of land in Potong Pasir. Situated along Woodsville Close, the prime plot of land is of Freehold residency and is perched on a city periphery area. Strolling separation to Potong Pasir MRT station serving the North-East Line, Woodsville 18 has 101 sumptuous Skysuites, Sky Gardens and Duplexes that one can call home.  

parc central residences price
0
Andrawsandro avatar Andrawsandro 0 Точки

We are once in the past known as Florence Regency at Hougang Avenue 2, presently named as The Florence Residences, with Chinese name as Previously it was at last been offered to Logan Property Developers, a Chinese designer. This aggregate deal was set apart by an arrangement worth S$629 million for the exchange of responsibility for property. The deal comes after the dismissal of offers surpassing the S$600 million hold value set by the proprietors of The Florence Residences Condo (Former Florence Regency)   

ola ec showflat
0
testss avatar testss 0 Точки

Situated at the previous site of Park West apartment suite, Parc Clematis appreciate easy access to significant vehicle hubs like the Clementi MRT Station and Clementi transport trade. It is additionally close to different renowned schools and comforts.  

parc central residence
0
bobbyzee avatar bobbyzee 1 Точки

Set up in 1840, Kajima Corporation jumps into various businesses,  the woodleigh residences however their history in land proceeds with its stalwart inheritance with a great arrangement of property improvement accomplishments. Kajima has taken part in significant development and improvement ventures since the designer's start, with establishes in the development of different structural building structures and, later, extra business, friendliness, and retail properties.

0
Rejipaulu avatar Rejipaulu 0 Точки

The magnificence of the encompassing and accessibility of parks implies a great deal to the private units in Hougang. The way that The Florence Residences is sited close to parks permits you, your family and your companions to get to an open space where you can appreciate participating in physical exercises. Be that as it may, there are more advantages to remaining close to parks. It will affect the lives of the occupants of The Florence Residences in an extraordinary manner thinking about that living amidst a characteristic world is very basic to having a solid existence for the two grown-ups and youngsters.  

https://ola-ec.com.sg/view-showflat/
0
felinadoe avatar felinadoe 1 Точки

Once more, a genuine contender, Microsoft dispatches Xbox reassure which still less well known than Sony Playstation 2. At that point came Generation 7 where Playstation's prominence diminished after it created Playstation 3 that was less serious than BOX360 and Nintendo with its most up to date yield Nintendo WII In the  Myeclass Mod APK Generation 8 as of recently. Sony Playstation, made an achievement made a leap forward by overhauling PS3 and transformed it into a PS4 with the goal that the quantity of deals right now and greater than the two contenders.

0
henryfoyal avatar henryfoyal 0 Точки

That is the place free film streaming applications act the hero, watch movies online disposing of the requirement for downloads and cash. Rather, the applications give you boundless admittance to motion pictures and TV shows for nothing. With the streaming applications, diversion quits cutting profoundly into your month to month spending plan.

-1
1
catherinejack avatar catherinejack 1 Точки

Following is a handpicked rundown of Top YouTube to MP3 Converter, youtube to mp3 converter with their mainstream highlights and site joins. The rundown contains open-source (free) and paid (business) programming.

0
princehenryy avatar princehenryy 1 Точки

In the event that you're an ordinary CSGO player, at that point one of the most well-known issues you more likely than not confronted while playing positioned are programmers destroying your matches csgo accounts. Programmers in CSGO are a typical event nowadays and you should have the option to confront them without giving up your position. On the off chance that you knew how, you'd have the option to shield yourself from purchasing positioned CSGO accounts. Keeping that in mind

0
takvor avatar takvor 45 Точки

#include <iostream>

int main() {
    double one, two, three;
    std::cin >> one >> two >> three;
    if (one*two*three < 0) std::cout << "-" << std::endl;
    else std::cout << "+" << std::endl;
    return 0;
}
 

0
takvor avatar takvor 45 Точки

Грешката, според мен, е, че ако има нула и едно отрицателно число, въртиш брояча, но произведението е положителна нула.

0
gowdhamsubramaniam avatar gowdhamsubramaniam 1 Точки

Web index advertising administrations help improve the general online perceivability of an association's site. There is a solid connection between's the quantity of impressions an organization Personal Blogger gets and securing new business. As Internet clients become more acquainted with a brand and their site, we see an expansion in movement to and commitment with a business' site. Search advertising assists with expanding brand mindfulness, site traffic and transformation rate.

0
gekdekzz avatar gekdekzz 0 Точки

When it comes to buying things or products relatable to gardening, fashion, children products and so on. You can take a look at the Geeky Deck.When it comes to buying things or https://geekydeck.com/  products relatable to gardening, fashion, children products and so on. You can take a look at the Geeky Deck.

0