- #define _CRT_SECURE_NO_WARNINGS
-
#include <stdio.h>
-
#include <conio.h>
-
void main ()
-
{
-
int month,year;
-
int days,weeks,left;
-
char x;
-
float a,b,c;
-
do
-
{
-
puts("Please enter:\nL to solve a linear equation\nD to calc the num of days in month\nW to calc the num of weeks and days");
-
fflush(stdin);
-
scanf("%c",&x);
-
while (x!= 'L' && x!='D' &&x!='W')
-
{
-
printf("Please type (L or D or W)\n");
-
fflush(stdin);
-
scanf("%c",&x);
-
}
-
switch(x)
-
{
-
case 'L':
-
puts("Please insert equation ax+b=0 argument (float): a ant than b");
-
fflush(stdin);
-
scanf("%f%f",&a,&b);
-
if (a==0 && b==0)
-
printf("there is infinity sulotions for the linear equation: %fx+%f=0 ",a,b);
-
else if (a==0)
-
printf("there is no sulotion for the linear equation: %fx+%f=0 ",a,b);
-
else
-
{
-
b=b*-1;
-
c=b/a;
-
printf("\nThe single sulotion for the linear equation is: %f\n",c);
-
}
-
break;
-
case 'D':
-
puts("Please enter the month (1 - 12) and the year");
-
fflush(stdin);
-
scanf("%d%d",&month,&year);
-
while (month > 12 || month < 1)
-
{
-
puts("No man! Please enter the month (1 - 12) and the year");
-
fflush(stdin);
-
scanf("%d%d",&month,&year);
-
}
-
if (month==2)
-
{
-
if (year%4==0,year%400==0)
-
printf("The num of days is 28\n");
-
else
-
puts("The num of days is 29");
-
}
-
else if(month<=7)
-
{
-
if (month%2==1)
-
puts("The num of days is 31");
-
else
-
puts("The num of days is 30");
-
}
-
else
-
{
-
if (month%2==0)
-
puts("The num of days is 31");
-
else
-
puts("The num of days is 30");
-
}
-
break;
-
default:
-
puts("Please enter a num of days");
-
fflush(stdin);
-
scanf("%d",&days);
-
while (days<0)
-
{
-
puts("Please try again to enter a positive num of days");
-
fflush(stdin);
-
scanf("%d",&days);
-
}
-
weeks=days/7;
-
left=days%7;
-
printf("The num of weeks is: %d and the num of days is: %d\n" , weeks ,left);
-
break;
-
}
-
puts("\n\npress any key to finish . . .");
-
_getch();
-
printf("\n===========================================================\n\n");
-
puts("\n\nGood bye and thank you, hope you enjoyed with my prog, dog.\n\n");
-
}
-
1 1509
In the future, please provide the full text of the compiler error message. That would make it a lot easier to help you.
I don't know if these issues are related to this error, but ... - Lines 26 and 35: the variable types are not consistent with the format string.
- Lines 26, 41, 46: you may need a separator between the two numbers.
- Line 50: the if-condition is illegal.
- Lines 13, 18, 25, 40, 45, 72, 77: I'm not sure, but I think flushing stdin yields undefined behavior.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: MLH |
last post by:
"The following unexpected error occurred in Sub CopyMySQLbttn_Click,
line #250, CBF on frmVehicleChooserform. 2465: "Can't find the field
'forms' referred to in your expression. You may have...
|
by: K7211 |
last post by:
Hi, I've been trying to use Visual C++.NET, but whenever I try to build a
solution I get this error message,
fatal error C1108: unable to find DLL: 'alink.dll'
Does anyone know what causes...
|
by: meenasamy |
last post by:
Hi all i have used a script that i downloaded and uses the
fopen($url,'r'); function to access a url to retrieve data and i get
this error
Fatal error: fopen(): Unable to find the wrapper...
|
by: Richard Lewis Haggard |
last post by:
I've created in form that has tab controls that contain tab controls that
host user controls on each tab page. It compiles and runs just fine but the
designer view fails with a "A circular control...
|
by: PW |
last post by:
Hi,
What the heck is that supposed to mean? I am getting this error on a
"Me.Requery" line in a subroutine on a form, but only when I select
something from a combo/dropdown box. The *exact*...
|
by: imu |
last post by:
hello,
please help !!!!!
my huge 1.3gb database is curropted.
try to repair it with command repair table table name but it can't work i have only .MYD,.MYI.frm back up file. so please how i...
|
by: tpgames |
last post by:
This code works how I want it too work.
2 letter quiz
This code does not work how I want it too. The links refuse to load up in the frame no matter what I change the 2.html link to be.
2.html
...
|
by: Sami Ward |
last post by:
I have an an MSAccess data project front end linked to an SQL Server Database.
I keep getting Error number 7874: database cannot find the object tblname
when I look however the table is there.
I...
|
by: dstorms |
last post by:
Hi,
I'm trying to create a button on a form that:
1. Takes the ComputerID from the form linked to Table 1,
2. Checks Table 2 for a matching ComputerID, and
3. Opens the query qryEditData, and...
|
by: Jim Rockett |
last post by:
"if(CURVE(RESD) < 0.001 ? 0.001 : CURVE(RESD))"
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |