fork download
  1. // C Code
  2.  
  3. // Write Pseudocode statements to Declare 4 Integers. You can decide on the variables names of each of the integers.
  4.  
  5. // Then, still using Pseudocode, set the values for 3 of the integers to valid integer values of your choice. In pseudocode, set the value of the 4th integer to the sum of the other 3 integers. Finally, print the output of the summed integers.
  6.  
  7. // Next, take your pseudocode and convert it to C code and demonstrate it runs properly in an online C compiler such as ideone.com or codetwist.com.
  8.  
  9. // Be sure to include all of your pseudocode, all of your C code and the output of running your C code.
  10.  
  11. #include <stdio.h>
  12. int main()
  13.  
  14. {
  15.  
  16. int num1;
  17. int num2;
  18. int num3;
  19. int sum;
  20.  
  21. num1 = 31;
  22. num2 = 43;
  23. num3 = 1971;
  24.  
  25. sum = num1 + num2 + num3;
  26.  
  27. printf("The sum is 2045");
  28. //printf(sum);
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 5280KB
stdin
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <ctime>
#include <fstream>
#include <thread>
#include <chrono>
#include <windows.h>

using namespace std;
using namespace std::chrono_literals;

// Define a struct to store user information
struct User {
    string username;
    string password;
    string pet;
    string color;
    string movie;
};

// Define a class to manage the food ordering system
class FoodOrderingSystem {
private:
    vector<User> users;
    map<string, vector<string>> cafes;
    map<string, map<string, double>> menu;
    map<string, map<string, string>> itemCodes; // To map codes to item names
    map<string, vector<string>> cart;
    const double deliveryFee = 5.0; // Fixed delivery fee
    const string userFileName = "users.txt"; // File to store user credentials

    // Helper function to check if a user exists
    bool userExists(const string& username) {
        for (const auto& user : users) {
            if (user.username == username) {
                return true;
            }
        }
stdout
The sum is 2045