Sample output:
Enter number of guests: 40
40 guests have been invited.
Enjoy the party!
Tips, Expertise, Articles and Advice from the Pro's for Your Website or Blog to Succeed
Sample output:
Enter number of guests: 40
40 guests have been invited.
Enjoy the party!
Hey, I would need some help.
I use Facebook API to get all the Ad Campaigns that exist on my account.
I would want each ad campaign that exists, to print out seperatly, one ad campaign per box for example (https://emildeveloping.se/screenshots/POWERPNT_JcaaOq2NXx.png).
This is my code now: https://pastebin.com/HAjSD6Nr
This is the data I get back from $result2: https://pastebin.com/gXcBRRn
The errors I get with my code right now: https://emildeveloping.se/screenshots/Code_f2AMuMqZgO.png
All help is appricated.
Score calculation
1.1 Write a function in Matlab that accepts the degree of writing as input arguments
bg and the degree of work be and return the final degree bt, which is calculated as o
average grades of work and writing with the following exceptions:
i. If the grade of the writing is zero then the final grade is 0.
ii. If the writing grade is less than 3, then the final grade is the average
if the average is less than 4, or otherwise 4.
iii. If the grade of the work is less than 5, then the final grade is the average
if the average is less than 4, or otherwise 4.
The final score will be rounded to the nearest whole number using the round (x) function.
1.2 Change the function so that it accepts registers as arguments.
Write a C# console program that allows the user to edit an address book by displaying the following menu to the user:
1- Add New Address
2- Delete Address
3- Modify Address
4- View Address
5- Quit
when the user enters 1 the program just displays "You wish to add an address." And it does similarly for choices 2, 3, and 4. When the user enters 5 the program ends. The program should repeatedly ask the user for a choice until the user enters 5. If the user, by mistake, enters anything other than an integer number between 1 and 5 inclusive, the program alerts the user by an error message then gives him the chance to continue by redisplaying the menu.
I am trying to convert the GMT time into unix epoch (starting from 1970), looks like there is a small bug
in code , i could not get and exhausted.
I see following difference
Non leap years
Expected output: Jan 20 19:00:01 2019 GMT = 1548010801
Actual output: 1548097201 (which is Jan 21 19:00:01 2019 GMT, 1 day difference)
Leap Year
Expected output: Dec 27 14:52:30 2020 GMT = 1609080750
Actual output: 1609253550 (which is Dec 29 14:52:30 2020 GMT, 2 days difference)
I really appreciate any help in finding the problem.
`
#include <stdio.h>
#include <string.h>
#include <time.h>
#define BASE_YEAR 1970
void print_time_readable_format(struct tm tm);
int convert_gmt_date_time_to_tm_format(char* gmt_time_fmt);
int check_year_is_leap_or_normal(int year);
int get_number_of_leap_years_from_base_year(int start_year, int end_year);
int convert_gmt_to_epoch(struct tm tm);
int main()
{
int epoch = 0;
//char gmt_time_fmt[] = "Jan 20 19:00:01 2019 GMT";
//char gmt_time_fmt[] = "Dec 27 14:52:30 2020 GMT";
char gmt_time_fmt[] = "Jan 01 00:00:00 1970 GMT";
epoch = convert_gmt_date_time_to_tm_format(gmt_time_fmt);
printf("time in GMT = %s and epoch is %d\n", gmt_time_fmt, epoch);
return 0;
}
int convert_gmt_date_time_to_tm_format(char* gmt_time_fmt)
{
struct tm tm;
char tm_time_fmt[255];
//set tm struture to 0
memset(&tm, 0, sizeof(struct tm));
// convert gmt_time_fmt to format required by 'tm' structure
strptime(gmt_time_fmt, "%B %d %H:%M:%S %Y GMT", &tm);
strftime(tm_time_fmt, sizeof(tm_time_fmt), "%s", &tm);
printf("tm_time_fmt = %s\n", tm_time_fmt);
print_time_readable_format(tm);
return convert_gmt_to_epoch(tm);
return 0;
}
int convert_gmt_to_epoch(struct tm tm)
{
int days_by_month [2][12] = {
/* normal years */
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334},
/* leap years */
{ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}
};
int current_year = tm.tm_year+1900;
printf("current_year =%d\n", current_year);
int total_years_passed = current_year - BASE_YEAR;
printf("total_years_passed =%d\n", total_years_passed);
int nleap_years_passed = get_number_of_leap_years_from_base_year(BASE_YEAR, current_year);
int normal_years = total_years_passed - nleap_years_passed;
printf("normal_years =%d\n", normal_years);
int total_days_passed = (normal_years*365 + nleap_years_passed*366 );
printf("total_days_passed =%d\n", total_days_passed);
total_days_passed += days_by_month[check_year_is_leap_or_normal(current_year)][tm.tm_mon];
printf("total_days_passed after adding month =%d\n", total_days_passed);
total_days_passed += tm.tm_mday;
printf("total_days_passed after adding day =%d\n", total_days_passed);
total_days_passed = total_days_passed*24 + tm.tm_hour;
total_days_passed = total_days_passed*60 + tm.tm_min;
total_days_passed = total_days_passed*60 + tm.tm_sec;
printf("total_days_passed final =%d\n", total_days_passed);
return total_days_passed;
}
int get_number_of_leap_years_from_base_year(int start_year, int end_year)
{
int leap_year_count = 0;
int year = start_year;
while( year <= end_year)
{
if(check_year_is_leap_or_normal(year))
leap_year_count++;
year++;
}
printf("leap_year_count = %d\n", leap_year_count);
return leap_year_count;
}
int check_year_is_leap_or_normal(int year)
{
if( ( year%4 == 0 ) && ( ( year%400 == 0 ) || ( year%100 != 0)))
return 1;
else
return 0;
}
void print_time_readable_format(struct tm tm)
{
printf("tm.tm_year = %d ", tm.tm_year);
printf("tm.tm_mon = %d ", tm.tm_mon);
printf("tm.tm_mday = %d ",tm.tm_mday);
printf("tm.tm_hour = %d ", tm.tm_hour);
printf("tm.tm_min = %d ", tm.tm_min );
printf("tm.tm_sec = %d\n", tm.tm_sec );
}
`
QB45 Error: Overflow, File record count > 32767 how to fix?
Write a program simulator that will compute for the average waiting time of each customer in a bank. Also the program will indicate the number of the teller who accomodates the customer.
Assume that the bank has 3 teller that may be accomodate the customers. The first customer to arrive will be served by teller 1 and the arrival time is zero(0). The second customer will be served by teller 2, the third customer by teller 3, the fourth customer will be served by the any teller who is already free and so on. The bank is using FIFO in serving their customers.
The length of service depends on the type of service the customer will avail. Services available in the bank are:
Deposit - 5 minutes
New accounts - 8 minutes
Withdrawal - 3 minutes
Check encash - 4 minutes
The program should reord the arrival time of each customer. For simplicity, assumed that the arrival time is in minutes. Again, the first customer will always have an arrival time of 0. Eliminate the concept of several clients that will arrive at exact;y the same time.
The program should be abale to determine the number of customers each teller accommodated.
The waiting time is computed as the time the service is started minus arrival time of the customer. For example, the first customer arrives at 0 and the service also started at time 0 since there is no queque yet. So, the waiting time for customer 1 is 0. If customer 2 arrives at time 5, he will be the first customer for teller 2. The service time will also start at time 5 thus, the waiting time of customer 2 is also 0.
Assume that the bank can serve 20 customers at the most.
int my number [10];
void fun(int input, int* addr){
if (input %2 == 0){
*addr = 1;
}
}
int main (){
int i;
for (i = 0; i < 10; i+=1){
fun(number[i], &number[i]);
}
return 0;
}
The user is going to enter the product number, then the program must be able to open the file, read the information of a inventory in the company, capture the information into an structured array and display the specific product with its information in the labels. all this using a multidimensional arrays and also the structures. currently in the execution it reads only one part of the data.
I think that the direct declaration of the array is causing part of the problem, also my program is not reading and capturing well.
Imports System.IO
Public Class frmMain
Public Structure sInventory
Public strProductNumber As String
Public strProductDescription As String
Public intProductQuantity As Integer
Public dblProductCost As Double
Public dblProductMarkup As Double
End Structure
Private Sub mnuBuscarProducto_Click(sender As Object, e As EventArgs) Handles mnuBuscarProducto.Click
' read the file
Dim inventarioFile As StreamReader
inventarioFile = File.OpenText("DatosInventario.txt")
'Array
Dim strProductos() As String = {"123", "234", "345", "456", "567", "678"}
Dim strDescripcion() As String = {"Juego de comedor con 2 sillas", "Sof cama", "Escritorio", "Cama king", "Librero de 6'", "Mueble para pecera"}
Dim intCantidad() As Integer = {15, 10, 25, 5, 35, 8}
Dim dblCostos() As Double = {425.0, 769.0, 250.0, 1875.0, 399.0, 350.0}
Dim dblProrciento() As Double = {0.25, 0.25, 0.35, 0.2, 0.3, 0.2}
Dim i As Integer = 0
Dim intProducto As Integer 'Valor que ingres el usuario capturado
'capture and validate
If Integer.TryParse(txtNumeroProducto.Text, intProducto) Then
intProducto = CInt(txtNumeroProducto.Text)
Else
MessageBox.Show("Debe ingresar un entero de tres dgitos")
End If
'Find something in the archive
Dim blnBuscador As Boolean = False
Do While blnBuscador = False And i <= (strProductos.Length - 1)
If strProductos(i) = intProducto Then
blnBuscador = True
lblDescripcion.Text = inventarioFile.ReadLine()
lblInventario.Text = inventarioFile.ReadLine()
lblCosto.Text = inventarioFile.ReadLine()
lblPrecioVenta.Text = inventarioFile.ReadLine()
lblImporteCosto.Text = inventarioFile.ReadLine
lblImportePrecioVenta.Text = inventarioFile.ReadLine
End If
Loop
i += 1
inventarioFile.Close()
End Sub
Private Sub frmMain_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If MessageBox.Show("Desea cerrar la aplicacin?", "Confirmar", MessageBoxButtons.YesNo) = DialogResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
End Sub
Private Sub mnuSalir_Click(sender As Object, e As EventArgs) Handles mnuSalir.Click
Me.Close()
frmSplash.Close()
End Sub
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Open the file text
ofdDatosInventario.ShowDialog()
End Sub
End Class
I played many games but none of them were soo good, but then i found sims4 and i'm playing it from last 1 year andi also want to know how can i make a better game than this with some more functions and updates. I found a website which tell everything about sims4, check it out and tell me how can i make a good game like this.
I want mini project of data structure using c language can anyone give source code??
strndup
?
char tav = str[strlen(str)/2+1];
int a,b,anser;
char* as = strndup(str, strlen(str) / 2 - *str);
char* bs = strndup(str+ strlen(str) / 2 - *str+2, strlen(str) / 2 - *str);
a = atoi(as);
b = atoi(bs);
if (tav == '+')
anser = a + b;
else if (tav == '-')
anser == a - b;
else if (tav == '*')
anser == a * b;
else if (tav == '/')
anser == a / b;
puts(str);
Hi everyone, I just want to ask if how i am able to make an if else statement inside a switch case. i want to execute something wherein the user may be able to choose again if he/she would like to do another transaction. for example, the user choose Yes the program will automatically display the main menu option and if the user doesn't want another the program will automatically print "Thankyou for using the program"
Hi guys, I have this assignment and I have to write a program to translate file from Piglatin to english without using the split function. My code only works for a word and I can't figure out how to do it for a sentence without the split function. Thanks in advance
So I just started learning Pascal and have problems understanding how deleting specific characters works
program Project1;
var
a:string;
b:char;
c:integer;
begin
readln(a);
b:=(chr(32));
for c:=1 to length(a) do
begin
if a[c]=b then delete;
end;
readln;
end.
The idea is that I input random text and get back the same text but without all spaces. Sounds simple but I just started learning pascal, so not really. Help would be appreciated :)
Probably more than one thing is wrong with this sh*t code.
#include <iostream>
using namespace std;
int main ()
int charge, aftercharge, parking_hours;
cout << "please put your parking hours: " ;
cin >> parking_hours;
if (parking_hours>=1)
{
charge = 1 ;
}
else if (parking_hours>=11)
{
charge = 2.50 ;
}
else if (parking_hours>=12)
{
charge = 6.00 ;
}
aftercharge = parking_hours*charge ;
cout << "your bills RM" << aftercharge;
cout << "this is your charge RM: " << parking_hours;
return 0;
Heres an example since A is a square matrix while B and C is not. The program on my head is a row and a colum counter then if the row and colum is equal to eachother then the system will print out that the A matrix is a square matrix and both B and C are not. Is their efficent way on doing this?
{7, 2, 1},
A = {0, 4, 2},
{5, 7,11} {1 },
C = {2, 3, 4},
{5, 6 }
{1, 4},
B = {2, 8},
{1, 6,}
hello, i have a probelm where i want to update my image in database using unlink(). The error is Warning: unlink(images/481933.jpg): No such file or directory. I try search the solution but nothing can solve my probelm. anyone can help me? thank you in advanced. this is my code:
$upload_dir='images/';
$imgExt=strtolower(pathinfo($images,PATHINFO_EXTENSION));
$valid_extensions=array('jpeg', 'jpg', 'png', 'gif', 'pdf');
$picProfile=rand(1000, 1000000).".".$imgExt;
unlink($upload_dir.$edit_row['prod_img']);
move_uploaded_file($tmp_dir, $upload_dir.$picProfile);
$stmt=$db_conn->prepare('UPDATE product SET prod_name=:prod_name, category=:category, prod_img=:prod_img, unit_price=:price, stock=:stock, min_limit=:min_limit, weight=:weight, description=:description, packaging=:packaging, size=:size, retail_price=:retail, agent_price=:agent WHERE prod_id=:prod_id');