Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Опубликовано:

y u no c++

 

#include 

int main ()
{
   char name[20]; 
   int voteA, voteB, voteC, voteD, ttlnmbr;
   float percentA, percentB, percentC, percentD;
   cout<<"Enter candidate name";
   cin>>name;
   cout<<"Insert the number of voters";
    cin>>voteA; // okay, what the hell is going on here. Didn't the instructions say the input was 1 number per line? take an int and switch it
   while (count != 0) // != is the correct operator, and you DON'T need a fucking ;
   {
         ttlnmbr = voteA + voteB + voteC + vote D; // DO end these with a ;!
         percentA = (float)((voteA * 100) / ttlnmbr); // I'm being a cast nazi
   }
   // what now? aren't you supposed to output it somehow? printf/sprintf?
}

Опубликовано:

Wow, I am still a beginner. Good luck, though mate. Also, those names....

Опубликовано:

Your intentions don't make much sense to me, and you should reread the instructions.

Why are you asking for the name? They are already given.

You are only asking for a single result..? make a nice little for loop that stores every number in an array, until 0 is entered.

Again, only processing a single result, include the calculation of the percentage in that same for loop, and store them to another array.

That while loop will run forever, or not at all, as count isn't declared.

You still need to print the results, use another for loop that prints every result on another line. (note that the names are in the order as in the instructions, the results are put in in the same order)

 

I think that's all :)

Опубликовано:

simple switch and while loop

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.